BUG: Series.resample fails on NaT PeriodIndex · Issue #39227 · pandas-dev/pandas (original) (raw)

@rhshadrach

Failure is only on Series and only when the index is entirely NaT.

freq = "D"

df = DataFrame([1, 2], index=PeriodIndex([NaT, NaT], freq=freq))
print(df.resample(freq).sum())

ser = Series([1, 2], index=PeriodIndex([NaT, NaT], freq=freq))
print(ser.resample(freq).sum())

Second raises, first returns the expected

Empty DataFrame
Columns: []
Index: []