I have the following data frame:
>>> df = pd.DataFrame([[True, np.nan, False],[True,np.nan,False],[True,np.nan,False]])
>>> df
0 1 2
0 True NaN False
1 True NaN False
2 True NaN False
According to the docs, doing df.all(axis=1, skipna=True)
corresponds to checking if all values are true column-wise, so I expected it to give True
,True
,False
, but it gives False
,False
,False
. It seems that the meaning of axis has been flipped, i.e. axis=0 is for columnwise.
This seems in contradiction with the meaning of axis in DataFrame.dropna
, for example,
>>> df.dropna(axis=1)
0 2
0 True False
1 True False
2 True False
as well as in np.delete
.
Was this intentional? And if so, why?