DEPR: Rolling.win_type returning freq & is_datetimelike by mroeschke · Pull Request #38963 · pandas-dev/pandas (original) (raw)

OK, that makes sense.

Another change that I noticed is the value stored in Rolling.window:

In [5]: freq_roll = Series(range(2), index=date_range("2020", periods=2)).rolling("2s")

In [6]: pd.__version__
Out[6]: '1.2.0'

In [7]: freq_roll.win_type
Out[7]: 'freq'

In [8]: freq_roll.window
Out[8]: 2000000000

In [9]: freq_roll.win_freq
Out[9]: '2s'

vs master:

In [1]: freq_roll = Series(range(2), index=date_range("2020", periods=2)).rolling("2s")

In [2]: freq_roll.win_type

In [3]: freq_roll.window
Out[3]: '2s'

So Rolling.window changed from an int (nanoseconds I suppose?) to the freq string. A change that makes sense I think (because the nanoseconds are not really useful, you need it as a Timedelta / actual window or so anyway).

But, that also makes it hard to follow the suggestion of "Check the type of self.window instead." in the deprecation warning (since this changed as well, or at least that means you need an actual pandas version check to do something different based on the pandas version, so not insurmountable in the end ;))