polars.rolling_corr#

polars.rolling_corr(
a: str | Expr,
b: str | Expr,
*,
window_size: int,
min_periods: int | None = None,
ddof: int = 1,
) Expr[source]#

Compute the rolling correlation between two columns/ expressions.

Warning

This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.

The window at a given row includes the row itself and the window_size - 1 elements before it.

Parameters:
a

Column name or Expression.

b

Column name or Expression.

window_size

The length of the window.

min_periods

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.

ddof

Delta degrees of freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.