datetime - Python pandas .isnull() does not work on NaT in object dtype -
i have series:
ser=pd.series([11,22,33,np.nan,np.datetime64('nat')],name='my_series')
the series looks this:
0 11 1 22 2 33 3 nan 4 nan name: my_series, dtype: object
but 1 true
null values:
ser.isnull() 0 false 1 false 2 false 3 true 4 false name: my_series, dtype: bool
is bug or how can count correctly null values in pandas series? not help:
ser=ser.replace('nan',np.nan)
thanks!
to around this, can do
series.apply(lambda x: str(x) == "nat")
then can still use np.datetime if want
Comments
Post a Comment