BUG: DatetimeIndex comparison handles NaT incorrectly by sinhrks · Pull Request #7529 · pandas-dev/pandas (original) (raw)

Derived from #7485. Comparison with DatetimeIndex result incorrectly if NaT is included.

idx1 = pd.DatetimeIndex(['2011-01-01', pd.NaT], freq='M')
idx2 = pd.DatetimeIndex([pd.NaT, '2011-01-01'], freq='M')
print(idx1 > idx2)
# [True, False]
# it must be [False, False]