Skip to content

DOC: document default behaviour of sample methods when random_state = None #59073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5731,7 +5731,7 @@ def sample(
replace : bool, default False
Allow or disallow sampling of the same row more than once.
weights : str or ndarray-like, optional
Default 'None' results in equal probability weighting.
Default ``None`` results in equal probability weighting.
If passed a Series, will align with target object on index. Index
values in weights not found in sampled object will be ignored and
index values in sampled object not in weights will be assigned
Expand All @@ -5746,6 +5746,7 @@ def sample(
random_state : int, array-like, BitGenerator, np.random.RandomState, np.random.Generator, optional
If int, array-like, or BitGenerator, seed for random number generator.
If np.random.RandomState or np.random.Generator, use as given.
Default ``None`` results in sampling with the current state of np.random.

.. versionchanged:: 1.4.0

Expand Down
2 changes: 2 additions & 0 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -5389,6 +5389,7 @@ def sample(
random_state : int, array-like, BitGenerator, np.random.RandomState, np.random.Generator, optional
If int, array-like, or BitGenerator, seed for random number generator.
If np.random.RandomState or np.random.Generator, use as given.
Default ``None`` results in sampling with the current state of np.random.

.. versionchanged:: 1.4.0

Expand All @@ -5403,6 +5404,7 @@ def sample(
See Also
--------
DataFrame.sample: Generate random samples from a DataFrame object.
Series.sample: Generate random samples from a Series object.
numpy.random.choice: Generate a random sample from a given 1-D numpy
array.

Expand Down