Skip to content

Commit

Permalink
feat(python)!: Change Series.shuffle default behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jan 2, 2023
1 parent db0c741 commit 3092b64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 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 @@ -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
----------
Expand Down
12 changes: 2 additions & 10 deletions py-polars/polars/internals/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand All @@ -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,
Expand Down

0 comments on commit 3092b64

Please sign in to comment.