PythonDataScienceHandbook icon indicating copy to clipboard operation
PythonDataScienceHandbook copied to clipboard

indexes as ordered set - issue in code

Open maxvolpi opened this issue 2 years ago • 1 comments

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

maxvolpi avatar Sep 07 '23 16:09 maxvolpi

Hey , can you please specify the section?

steve-edward avatar Aug 26 '24 14:08 steve-edward