pyspark.pandas.Series.rolling

Series.rolling(window: int, min_periods: Optional[int] = None) → Rolling[FrameLike]

Provide rolling transformations.

Note

‘min_periods’ in pandas-on-Spark works as a fixed window size unlike pandas. Unlike pandas, NA is also counted as the period. This might be changed in the near future.

Parameters
windowint, or offset

Size of the moving window. This is the number of observations used for calculating the statistic. Each window will be a fixed size.

min_periodsint, default None

Minimum number of observations in window required to have a value (otherwise result is NA). For a window that is specified by an offset, min_periods will default to 1. Otherwise, min_periods will default to the size of the window.

Returns
a Window sub-classed for the particular operation