Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

The or and and python statements require truth-values. For pandas these are considered ambiguous so you should use “bitwise” | (or) or & (and) operations: df = df[(df[‘col’] < -0.25) | (df[‘col’] > 0.25)] These are overloaded for these kind of data structures to yield the element-wise or (or and). Just to add some more … Read more