pyspark.pandas.DataFrame.rolling

DataFrame.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 soon.

Parameters
window: int, 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_periods: int, 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 operation