Rolling#

Rolling window operations for calculating statistics over a sliding window.

Example#

import pandasCore as pd

s = pd.Series([1, 2, 3, 4, 5])
s.rolling(window=3).mean()  # [NaN, NaN, 2.0, 3.0, 4.0]
s.rolling(window=3).sum()   # [NaN, NaN, 6.0, 9.0, 12.0]

Parameters#

Parameter

Type

Default

Description

window

int

required

Size of moving window

min_periods

int

None

Minimum observations needed

center

bool

False

Set labels at center

win_type

str

None

Window type for weighted

on

str

None

Column to use for window

axis

int

0

Axis to roll on

closed

str

None

Which side is closed

Methods#

Method

Description

count()

Count of observations

sum()

Sum of values

mean()

Mean of values

median()

Median of values

var()

Variance

std()

Standard deviation

min()

Minimum

max()

Maximum

corr()

Correlation

cov()

Covariance

skew()

Skewness

kurt()

Kurtosis

apply(func)

Apply custom function

agg(func)

Aggregate with function(s)

quantile(q)

Quantile

sem()

Standard error of mean

rank()

Rank