0

I want to determine if a value lies within a range and create a boolean for that.

for index in etData.iterrows():
    if np.logical_and(etData['lr_x'] >= -0.49, etData['lr_x'] <=-0.31):
        etData['3_1']= True

This is the code I got. I keep getting an error: through value of a series is ambiguous.

  • Have you read the duplicate question link in your previous question? Can you provide a sample of etData? – mozway Apr 14 '22 at 13:51
  • You likely just want `etData.loc[etData['lr_x'].between(-0.49, -0.31), '3_1'] = True`, not need for a loop and `iterrows` – mozway Apr 14 '22 at 13:53

0 Answers0