jakevdp / PythonDataScienceHandbook

Python Data Science Handbook: full text in Jupyter Notebooks
http://jakevdp.github.io/PythonDataScienceHandbook
MIT License
42.69k stars 17.82k forks source link

indexes as ordered set - issue in code #380

Open maxvolpi opened 1 year ago

maxvolpi commented 1 year ago

I am trying to reproduce the code on page 107 of the first edition (and it is the same on Github). When I do indA & indB I get a strange result: [0,3,5, 7,9] while if I use the code set(indA) & set(indB) I get the expected result {3,5,7}. I also get the same correct result if I use the method indA.intersection(indB).

Likewise, I get funny results with | and ^. while the equivalent set operations and the methods all work.

It is not clear why this is happening, as I have tried it from scratch a few times, to avoid typos

Steven-Willers commented 1 week ago

Hey , can you please specify the section?