Can anyone explain the following behaviour. I am expecting all three rows to be returned.
import pandas as pd
test_dict = {
'col1':[None, None, None],
'col2':[True, False, True],
'col3':[True, True, False]
}
df = pd.DataFrame(test_dict)
df[ df.col1 | df.col2 | df.col3 ]
>>> Return only first two rows (index 0 and 1)
Replacing the None values with empty strings using df.fillna('') appears to fix it but I don't understand why the first two rows work fine if None is an issue.
Also changing the order of the comparisons effects it. If I swap col2 and col3 in the mask then the row with index 1 is no longer returned but the row with index 2 is returned. If col1 comes last then all rows are returned.