pandas.api.typing.DataFrameGroupBy.rolling
pandas 3.1.1 · GroupBy · method
Build a moving window defined by an observation count, time span or custom indexer.
Call syntax
pd.api.typing.DataFrameGroupBy.rolling(…) Full signature
pd.api.typing.DataFrameGroupBy.rolling(
window,
min_periods=None,
center=False,
win_type=None,
on=None,
closed=None,
method='single',
)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
window |
Required Positional or keyword |
int, timedelta, str, offset, or BaseIndexer subclass Set the number of observations, time span, or custom indexer defining each window. |
min_periods |
Optional Positional or keyword Default None |
int Require this many valid observations in a window before pandas reports a value. |
center |
Optional Positional or keyword Default False |
bool Set each result's label to the center of its window where supported. |
win_type |
Optional Positional or keyword Default None |
str Choose a SciPy window type for weighted rolling calculations. |
on |
Optional Positional or keyword Default None |
str Choose the shared key columns or name the axis column used by the operation. |
closed |
Optional Positional or keyword Default None |
str Choose which interval boundaries are included. |
method |
Optional Positional or keyword Default 'single' |
str {'single', 'table'} Choose the algorithm used to calculate, align, or fill the result. |
Returns
pandas.api.typing.RollingGroupBy