Hello, I'm a Python Baby and am going through the book line by line.
Section 2.4.1 Boolean Subsetting: DataFrames has a command line which is not performing the way the book suggests.
4 values passed as bool vector
3 rows returned
print(scientists.loc[[True, True, False, True]])
The book says that 3 rows should be returned, index 0, 1 and 3.
Which seems to make sense.
But the Return line says
IndexError: Boolean index has wrong length: 4 instead of 8
Which also seems to make sense, so I'm confused.
Hello, I'm a Python Baby and am going through the book line by line. Section 2.4.1 Boolean Subsetting: DataFrames has a command line which is not performing the way the book suggests.
4 values passed as bool vector
3 rows returned
print(scientists.loc[[True, True, False, True]])
The book says that 3 rows should be returned, index 0, 1 and 3. Which seems to make sense.
But the Return line says IndexError: Boolean index has wrong length: 4 instead of 8 Which also seems to make sense, so I'm confused.
Can I get some clarification? Thanks Paul