w3resource

Pandas DataFrame - expanding() function

DataFrame - expanding() function

The expanding() function is used to provide expanding transformations.

Syntax:

DataFrame.expanding(self, min_periods=1, center=False, axis=0)

Parameters:

Name Description Type/Default Value Required / Optional
min_periods Minimum number of observations in window required to have a value (otherwise result is NA). int
Default Value: 1
Required
center Set the labels at the center of the window. bool
Default Value: False
Required
axis    int or str
Default Value: 0
Required

Returns: a Window sub-classed for the particular operation

Notes:

By default, the result is set to the right edge of the window. This can be changed to the center of the window by setting center=True.

Example:


Download the above Notebook from here.

Previous: DataFrame - rolling() function
Next: DataFrame - ewm() function