Closed
Description
I am not sure if this is on purpose, but as far as I know, or
operation should be symmetric ( I mean a | b == b | a
); not in pandas:
>>> a = pd.Series( [True] )
>>> b = pd.Series( [np.nan] )
>>> a | b
0 True
dtype: bool
>>> b | a
0 False
dtype: bool
is there any reason pandas is treating NaN
values asymmetrically in here?
also, this is a weird outcome as well:
>>> ( b == True ) | ( a == True )
0 True
dtype: bool
and this:
>>> b.astype( bool )
0 True
dtype: bool
this even has internal inconsistency; so before in b | a
, NaN
was treated as False
, but now here it is True
;