pandas.api.indexers.
FixedForwardWindowIndexer
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(self, num_values, …)
get_window_bounds
Computes the bounds of a window.