dask_expr._groupby.SeriesGroupBy.rolling

dask_expr._groupby.SeriesGroupBy.rolling

SeriesGroupBy.rolling(window, min_periods=None, center=False, win_type=None, axis=0)

Provides rolling transformations.

Note

Since MultiIndexes are not well supported in Dask, this method returns a dataframe with the same index as the original data. The groupby column is not added as the first level of the index like pandas does.

This method works differently from other groupby methods. It does a groupby on each partition (plus some overlap). This means that the output has the same shape and number of partitions as the original.

Parameters
windowstr, offset

Size of the moving window. This is the number of observations used for calculating the statistic. Data must have a DatetimeIndex

min_periodsint, default None

Minimum number of observations in window required to have a value (otherwise result is NA).

centerboolean, default False

Set the labels at the center of the window.

win_typestring, default None

Provide a window type. The recognized window types are identical to pandas.

axisint, default 0
Returns
a Rolling object on which to call a method to compute a statistic

Examples

>>> import dask
>>> ddf = dask.datasets.timeseries(freq="1h")
>>> result = ddf.groupby("name").x.rolling('1D').max()