0

I want to go through all rows of my data frame to see if a data point falls within the range of two values. If the data point lies in the correct range for the x coordinate and y than the column etData['3_1'] should display a True in that row.

for index in etData.iterrows(): 
    if ((etData['lr_x'] >= -0.49) & (etData['lr_x'] >=-0.31)) & 
    ((etData['lr_y'] >= 0.31) & (etData['lr_y'] >=0.49)): 
    etData['3_1']= True

This is the code I got I tried using and, & and the numpy.logical_and. I keep getting an error: through value of a series is ambiguous.

Thank you for any help!

Alessandro Togni
  • 335
  • 3
  • 15
  • the issue is the `if ... (boolean series) ... else`, this is ambiguous, you need to aggregate or to change the comparison logic to scalars – mozway Apr 14 '22 at 12:26

0 Answers0