Using and statements to create Boolean iterate over rows

32 views Asked by At

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 keep getting an error: through value of a series is ambiguous.

Thank you for any help!

0

There are 0 answers