PythonDataScienceHandbook icon indicating copy to clipboard operation
PythonDataScienceHandbook copied to clipboard

Bitwise operators are conflated with intersection, union, symmetric difference operators in NB 03.01

Open deburg0 opened this issue 5 months ago • 0 comments

In the Section "Index as ordered Set", Bitwise operators are mistakenly equated with Set Operators: intersection, union, symmetric difference.

indA = pd.Index([1, 3, 5, 7, 9])
indB = pd.Index([2, 3, 5, 7, 11])

indA.intersection(indB)
Index([3, 5, 7], dtype='int64')

indA & indB # intersection (actually binary AND)
Index([0, 3, 5, 7, 9], dtype='int64')

Not a big deal, but confusing.

Thank you for your book.

deburg0 avatar Jul 26 '25 10:07 deburg0