I have a df like this:
a b c
1 NaT w
2 2014-02-01 g
3 NaT x
df=df[df.b==\'2014-02-01\']
I feel that the comment by @DSM is worth a answer on its own, because this answers the fundamental question.
The misunderstanding comes from the assumption that pd.NaT
acts like None
. However, while None == None
returns True
, pd.NaT == pd.NaT
returns False
. Pandas NaT
behaves like a floating-point NaN
, which is not equal to itself.
As the previous answer explain, you should use
df[df.b.isnull()] # or notnull(), respectively