Skip to content

Commit

Permalink
feat(python)!: Change Series.shuffle default behaviour (#5991)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Jan 26, 2023
1 parent cfa8dbe commit 8f8b7e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion py-polars/polars/internals/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5314,7 +5314,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
----------
Expand Down
13 changes: 2 additions & 11 deletions py-polars/polars/internals/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Union,
overload,
)
from warnings import warn

from polars import internals as pli
from polars.datatypes import (
Expand Down Expand Up @@ -4604,7 +4603,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
--------
Expand All @@ -4619,15 +4619,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,
Expand Down

0 comments on commit 8f8b7e7

Please sign in to comment.