One minor thing, which wasted my time.
Put the conditions(if comparing using " = ", " != ") in parenthesis, failing to do so also raises this exception. This will work
df[(some condition) conditional operator (some conditions)]
This will not
df[some condition conditional-operator some condition]