0
Boolean operators in Pandas DataFrame.
Why both these statements are giving different outputs ? Both have the same logic. print(temperatures[(temperatures["date"] >= "2010") & (temperatures["date"] < "2012")]) print(temperatures[(temperatures["date"] == "2010") | (temperatures["date"] == "2011")])
3 Answers
+ 1
logical operators in python are "and" "or", & | are bitwise operators.
so change & to and , | to or.
0
did you mean to use & | as [and] and [or] the logical operators or bitwise operators?
0
Logical operator