Filtering all rows with NaT in a column in Dataframe python

isnull and notnull work with NaT so you can handle them much the same way you handle NaNs:

>>> df

   a          b  c
0  1        NaT  w
1  2 2014-02-01  g
2  3        NaT  x

>>> df.dtypes

a             int64
b    datetime64[ns]
c            object

just use isnull to select:

df[df.b.isnull()]

   a   b  c
0  1 NaT  w
2  3 NaT  x

Leave a Comment