From 3092b64665acdc463f816c2159dd1c02c5516532 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Mon, 2 Jan 2023 14:51:33 +0100 Subject: [PATCH] feat(python)!: Change `Series.shuffle` default behaviour --- py-polars/polars/internals/expr/expr.py | 2 +- py-polars/polars/internals/series/series.py | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/py-polars/polars/internals/expr/expr.py b/py-polars/polars/internals/expr/expr.py index f75b47812e87e..629596f566026 100644 --- a/py-polars/polars/internals/expr/expr.py +++ b/py-polars/polars/internals/expr/expr.py @@ -5271,7 +5271,7 @@ def reshape(self, dims: tuple[int, ...]) -> Expr: def shuffle(self, seed: int | None = None) -> Expr: """ - Shuffle the contents of this expr. + Shuffle the contents of this expression. Parameters ---------- diff --git a/py-polars/polars/internals/series/series.py b/py-polars/polars/internals/series/series.py index d5003531ac28a..3a74707105eea 100644 --- a/py-polars/polars/internals/series/series.py +++ b/py-polars/polars/internals/series/series.py @@ -4566,7 +4566,8 @@ def shuffle(self, seed: int | None = None) -> Series: Parameters ---------- seed - Seed for the random number generator. + Seed for the random number generator. If set to None (default), a random + seed is generated using the ``random`` module. Examples -------- @@ -4581,15 +4582,6 @@ def shuffle(self, seed: int | None = None) -> Series: ] """ - if seed is None: - warn( - "Series.shuffle will default to a random seed in a future version." - " Provide a value for the seed argument to silence this warning.", - DeprecationWarning, - stacklevel=2, - ) - seed = 0 - return self.to_frame().select(pli.col(self.name).shuffle(seed)).to_series() def ewm_mean( self,