COMPAT: NaT accessors by jreback · Pull Request #15782 · pandas-dev/pandas (original) (raw)

closes #15781

PR

In [1]: idx = DatetimeIndex(['1/1/2000', None, None, '1/4/2000'])

In [2]: idx.is_month_start
Out[2]: array([ True, False, False, False], dtype=bool)

In [3]: idx.is_leap_year
Out[3]: array([ True, False, False,  True], dtype=bool)

0.19.2

In [1]: idx = DatetimeIndex(['1/1/2000', None, None, '1/4/2000'])

In [3]: idx.is_month_start
Out[3]: array([  1.,  nan,  nan,   0.])

In [2]: idx.is_leap_year
Out[2]: array([ True, False, False,  True], dtype=bool)

mimics is_leap_year to return a boolean (inlcuding for NaT).