I have a DataFrame and I would like to check if any of the values (v) of the column satisfy x<=v<=y.
equal = any(df['columnX'] == value) # No problems here
in_between = any(x <= df['columnX'] <= y) # ValueError :/
I get an error ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()., but I'm already using it any()!
So what's the problem? Why does he work with ==, not with x<=v<=y?
source
share