DEPR: Resample with PeriodIndex? · Issue #53481 · pandas-dev/pandas (original) (raw)
Resampling with PeriodIndex is very very broken:
pi = pd.period_range(start="2000", periods=3, freq="M")
ser= pd.Series(["foo", "bar", "baz"], index=pi)
rs = ser.resample("M") # should be a no-op!
>>> rs.nunique()
2000-01 foo
2000-02 bar
2000-03 baz
Freq: M, dtype: object
Some of this is because in PeriodIndexResampler._downsample (which many methods go through) we just return self.asfreq()
in many cases which is very much wrong. We have some xfailed tests (e.g. test_resample_nat_index_series) that cause this as well as some actively-incorrect tests (e.g. test_resample_empty_dtypes, test_resample_same_freq)
Is this worth fixing or should we just deprecate it?