pandas/expanding

Expanding Window

Calculate expanding statistics

pandas
expanding
window

Command

df.expanding

Explanation

df.expanding() provides cumulative calculations from the start of the Series.

Examples

Cumulative expanding mean

df["col"].expanding().mean()

Cumulative sum over time

df["col"].expanding().sum()