From b03b5b7a474e0f7e6d92362b7d80a3ebca50b31f Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Wed, 24 Jan 2024 15:13:54 +0100 Subject: [PATCH] Mark other rolling as unstable --- py-polars/polars/functions/lazy.py | 10 ++++++ py-polars/polars/series/series.py | 53 ++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/py-polars/polars/functions/lazy.py b/py-polars/polars/functions/lazy.py index 320fa27aac93..afd8e7d127d5 100644 --- a/py-polars/polars/functions/lazy.py +++ b/py-polars/polars/functions/lazy.py @@ -2031,6 +2031,7 @@ def from_epoch( raise ValueError(msg) +@unstable() def rolling_cov( a: str | Expr, b: str | Expr, @@ -2042,6 +2043,10 @@ def rolling_cov( """ Compute the rolling covariance 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. @@ -2071,6 +2076,7 @@ def rolling_cov( ) +@unstable() def rolling_corr( a: str | Expr, b: str | Expr, @@ -2082,6 +2088,10 @@ def rolling_corr( """ 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. diff --git a/py-polars/polars/series/series.py b/py-polars/polars/series/series.py index cd929c637a8f..6b9477c87396 100644 --- a/py-polars/polars/series/series.py +++ b/py-polars/polars/series/series.py @@ -5398,6 +5398,7 @@ def zip_with(self, mask: Series, other: Series) -> Self: """ return self._from_pyseries(self._s.zip_with(mask._s, other._s)) + @unstable() def rolling_min( self, window_size: int, @@ -5409,6 +5410,10 @@ def rolling_min( """ Apply a rolling min (moving min) over the values in this array. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + 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 min. @@ -5456,6 +5461,7 @@ def rolling_min( .to_series() ) + @unstable() def rolling_max( self, window_size: int, @@ -5467,6 +5473,10 @@ def rolling_max( """ Apply a rolling max (moving max) over the values in this array. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + 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 max. @@ -5514,6 +5524,7 @@ def rolling_max( .to_series() ) + @unstable() def rolling_mean( self, window_size: int, @@ -5525,6 +5536,10 @@ def rolling_mean( """ Apply a rolling mean (moving mean) over the values in this array. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + 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 mean. @@ -5572,6 +5587,7 @@ def rolling_mean( .to_series() ) + @unstable() def rolling_sum( self, window_size: int, @@ -5583,6 +5599,10 @@ def rolling_sum( """ Apply a rolling sum (moving sum) over the values in this array. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + 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. @@ -5630,6 +5650,7 @@ def rolling_sum( .to_series() ) + @unstable() def rolling_std( self, window_size: int, @@ -5642,6 +5663,10 @@ def rolling_std( """ Compute a rolling std dev. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + 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 std dev. @@ -5692,6 +5717,7 @@ def rolling_std( .to_series() ) + @unstable() def rolling_var( self, window_size: int, @@ -5704,6 +5730,10 @@ def rolling_var( """ Compute a rolling variance. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + 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 variance. @@ -5754,6 +5784,7 @@ def rolling_var( .to_series() ) + @unstable() def rolling_map( self, function: Callable[[Series], Any], @@ -5767,8 +5798,8 @@ def rolling_map( Compute a custom rolling window function. .. warning:: - Computing custom functions is extremely slow. Use specialized rolling - functions such as :func:`Series.rolling_sum` if at all possible. + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. Parameters ---------- @@ -5791,7 +5822,8 @@ def rolling_map( Warnings -------- - + Computing custom functions is extremely slow. Use specialized rolling + functions such as :func:`Series.rolling_sum` if at all possible. Examples -------- @@ -5809,6 +5841,7 @@ def rolling_map( ] """ + @unstable() def rolling_median( self, window_size: int, @@ -5820,6 +5853,10 @@ def rolling_median( """ Compute a rolling median. + .. warning:: + This functionality is considered **unstable**. It may be changed + at any point without it being considered a breaking change. + Parameters ---------- window_size @@ -5867,6 +5904,7 @@ def rolling_median( .to_series() ) + @unstable() def rolling_quantile( self, quantile: float, @@ -5880,6 +5918,10 @@ def rolling_quantile( """ Compute a rolling quantile. + .. 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 will include the row itself and the `window_size - 1` elements before it. @@ -5947,10 +5989,15 @@ def rolling_quantile( .to_series() ) + @unstable() def rolling_skew(self, window_size: int, *, bias: bool = True) -> Series: """ Compute a rolling skew. + .. 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.