I know this question has been asked before, however, when I am trying to do an if
statement and I am getting an error. I looked at this link , but did not help much in my case. My dfs
is a list of DataFrames.
I am trying the following,
for i in dfs:
if (i['var1'] < 3.000):
print(i)
Gives the following error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
AND I tried the following and getting the same error.
for i,j in enumerate(dfs):
if (j['var1'] < 3.000):
print(i)
My var1
data type is float32
. I am not using any other logical
operators and &
or |
. In the above link it seemed to be because of using logical operators. Why do I get ValueError
?