Skip to main content
`Ctrl`+`K`

# Window

Note

For an overview, see Windowing operations.

`pandas.api.typing.Rolling` instances are returned by `.rolling` calls: `pandas.DataFrame.rolling()` and `pandas.Series.rolling()`. `pandas.api.typing.Expanding` instances are returned by `.expanding` calls: `pandas.DataFrame.expanding()` and `pandas.Series.expanding()`. `pandas.api.typing.ExponentialMovingWindow` instances are returned by `.ewm` calls: `pandas.DataFrame.ewm()` and `pandas.Series.ewm()`.

## Rolling window functions

`Rolling.count`([numeric_only]) | Calculate the rolling count of non NaN observations.
`Rolling.sum`([numeric_only, engine, ...]) | Calculate the rolling sum.
`Rolling.mean`([numeric_only, engine, ...]) | Calculate the rolling mean.
`Rolling.median`([numeric_only, engine, ...]) | Calculate the rolling median.
`Rolling.var`([ddof, numeric_only, engine, ...]) | Calculate the rolling variance.
`Rolling.std`([ddof, numeric_only, engine, ...]) | Calculate the rolling standard deviation.
`Rolling.min`([numeric_only, engine, ...]) | Calculate the rolling minimum.
`Rolling.max`([numeric_only, engine, ...]) | Calculate the rolling maximum.
`Rolling.first`([numeric_only]) | Calculate the rolling First (left-most) element of the window.
`Rolling.last`([numeric_only]) | Calculate the rolling Last (right-most) element of the window.
`Rolling.corr`([other, pairwise, ddof, ...]) | Calculate the rolling correlation.
`Rolling.cov`([other, pairwise, ddof, ...]) | Calculate the rolling sample covariance.
`Rolling.skew`([numeric_only]) | Calculate the rolling unbiased skewness.
`Rolling.kurt`([numeric_only]) | Calculate the rolling Fisher's definition of kurtosis without bias.
`Rolling.apply`(func[, raw, engine, ...]) | Calculate the rolling custom aggregation function.
`Rolling.pipe`(func, *args, **kwargs) | Apply a `func` with arguments to this Rolling object and return its result.
`Rolling.aggregate`([func]) | Aggregate using one or more operations over the specified axis.
`Rolling.quantile`(q[, interpolation, ...]) | Calculate the rolling quantile.
`Rolling.sem`([ddof, numeric_only]) | Calculate the rolling standard error of mean.
`Rolling.rank`([method, ascending, pct, ...]) | Calculate the rolling rank.
`Rolling.nunique`([numeric_only]) | Calculate the rolling nunique.

## Weighted window functions

`Window.mean`([numeric_only]) | Calculate the rolling weighted window mean.
`Window.sum`([numeric_only]) | Calculate the rolling weighted window sum.
`Window.var`([ddof, numeric_only]) | Calculate the rolling weighted window variance.
`Window.std`([ddof, numeric_only]) | Calculate the rolling weighted window standard deviation.

## Expanding window functions

`Expanding.count`([numeric_only]) | Calculate the expanding count of non NaN observations.
`Expanding.sum`([numeric_only, engine, ...]) | Calculate the expanding sum.
`Expanding.mean`([numeric_only, engine, ...]) | Calculate the expanding mean.
`Expanding.median`([numeric_only, engine, ...]) | Calculate the expanding median.
`Expanding.var`([ddof, numeric_only, engine, ...]) | Calculate the expanding variance.
`Expanding.std`([ddof, numeric_only, engine, ...]) | Calculate the expanding standard deviation.
`Expanding.min`([numeric_only, engine, ...]) | Calculate the expanding minimum.
`Expanding.max`([numeric_only, engine, ...]) | Calculate the expanding maximum.
`Expanding.first`([numeric_only]) | Calculate the expanding First (left-most) element of the window.
`Expanding.last`([numeric_only]) | Calculate the expanding Last (right-most) element of the window.
`Expanding.corr`([other, pairwise, ddof, ...]) | Calculate the expanding correlation.
`Expanding.cov`([other, pairwise, ddof, ...]) | Calculate the expanding sample covariance.
`Expanding.skew`([numeric_only]) | Calculate the expanding unbiased skewness.
`Expanding.kurt`([numeric_only]) | Calculate the expanding Fisher's definition of kurtosis without bias.
`Expanding.apply`(func[, raw, engine, ...]) | Calculate the expanding custom aggregation function.
`Expanding.pipe`(func, *args, **kwargs) | Apply a `func` with arguments to this Expanding object and return its result.
`Expanding.aggregate`([func]) | Aggregate using one or more operations over the specified axis.
`Expanding.quantile`(q[, interpolation, ...]) | Calculate the expanding quantile.
`Expanding.sem`([ddof, numeric_only]) | Calculate the expanding standard error of mean.
`Expanding.rank`([method, ascending, pct, ...]) | Calculate the expanding rank.
`Expanding.nunique`([numeric_only]) | Calculate the expanding nunique.

## Exponentially-weighted window functions

`ExponentialMovingWindow.mean`([numeric_only, ...]) | Calculate the ewm (exponential weighted moment) mean.
`ExponentialMovingWindow.sum`([numeric_only, ...]) | Calculate the ewm (exponential weighted moment) sum.
`ExponentialMovingWindow.std`([bias, numeric_only]) | Calculate the ewm (exponential weighted moment) standard deviation.
`ExponentialMovingWindow.var`([bias, numeric_only]) | Calculate the ewm (exponential weighted moment) variance.
`ExponentialMovingWindow.corr`([other, ...]) | Calculate the ewm (exponential weighted moment) sample correlation.
`ExponentialMovingWindow.cov`([other, ...]) | Calculate the ewm (exponential weighted moment) sample covariance.

## Window indexer

Base class for defining custom window boundaries.

`api.indexers.BaseIndexer`([index_array, ...]) | Base class for window bounds calculations.
`api.indexers.FixedForwardWindowIndexer`([...]) | Creates window boundaries for fixed-length windows that include the current row.
`api.indexers.VariableOffsetWindowIndexer`([...]) | Calculate window boundaries based on a non-fixed offset such as a BusinessDay.