pandas.api.indexers.FixedForwardWindowIndexer

class pandas.api.indexers.FixedForwardWindowIndexer(index_array=None, window_size=0, **kwargs)[source]

Creates window boundaries for fixed-length windows that include the current row.

Examples

>>> df = pd.DataFrame({'B': [0, 1, 2, np.nan, 4]})
>>> df
     B
0  0.0
1  1.0
2  2.0
3  NaN
4  4.0
>>> indexer = pd.api.indexers.FixedForwardWindowIndexer(window_size=2)
>>> df.rolling(window=indexer, min_periods=1).sum()
     B
0  1.0
1  3.0
2  2.0
3  4.0
4  4.0

Methods

get_window_bounds([num_values, min_periods, ...])

Computes the bounds of a window.

© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.api.indexers.FixedForwardWindowIndexer.html