- window_size: int,
- weights: list[float] | None = None,
- min_periods: int | None = None,
- center: bool = False,
- ddof: int = 1,
Compute a rolling variance.
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 window at a given row will include the row itself and the window_size - 1 elements before it.
The length of the window.
An optional slice with the same length as 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
“Delta Degrees of Freedom”: The divisor for a length N window is N - ddof
>>> s = pl.Series("a", [1.0, 2.0, 3.0, 4.0, 6.0, 8.0]) >>> s.rolling_var(window_size=3) shape: (6,) Series: 'a' [f64] [ null null 1.0 1.0 2.333333 4.0 ]