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")])

27th Apr 2020, 11:57 AM
harshit
harshit - avatar
3 Respuestas
+ 1
logical operators in python are "and" "or", & | are bitwise operators. so change & to and , | to or.
27th Apr 2020, 3:15 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
did you mean to use & | as [and] and [or] the logical operators or bitwise operators?
27th Apr 2020, 12:59 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
Logical operator
27th Apr 2020, 2:52 PM
harshit
harshit - avatar