w3resource

Pandas Series: expanding() function

Expanding transformations in Pandas

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

Syntax:

Series.expanding(self, min_periods=1, center=False, axis=0)
Pandas Series expanding image

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 If the axis is a MultiIndex (hierarchical), group by a particular level or levels.

nt 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.



Inviting useful, relevant, well-written and unique guest posts