- Series.rolling_sum(window_size: int, weights: list[float] | None = None, min_periods: int | None = None, center: bool = False) Series [source]#
Apply a rolling sum (moving sum) over the values in this array.
A window of length window_size will traverse the array. The values that fill this window will (optionally) be multiplied with the weights given by the weight vector. The resulting values will be aggregated to their sum.
The length of the window.
An optional slice with the same length of the window that will be multiplied elementwise with the values in the window.
The number of values in the window that should be non-null before computing a result. If None, it will be set equal to window size.
Set the labels at the center of the window
>>> s = pl.Series("a", [1, 2, 3, 4, 5]) >>> s.rolling_sum(window_size=2) shape: (5,) Series: 'a' [i64] [ null 3 5 7 9 ]