Skip to content

Commit 5b6d02c

Browse files
author
ottiP
committed
DOC: Improved the docstring of pandas.Series.sample
1 parent 4131149 commit 5b6d02c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pandas/core/generic.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3718,7 +3718,9 @@ def tail(self, n=5):
37183718
def sample(self, n=None, frac=None, replace=False, weights=None,
37193719
random_state=None, axis=None):
37203720
"""
3721-
Returns a random sample of items from an axis of object.
3721+
Return a random sample of items from an axis of object.
3722+
3723+
You can use `random state` for reproducibility
37223724
37233725
Parameters
37243726
----------
@@ -3753,9 +3755,17 @@ def sample(self, n=None, frac=None, replace=False, weights=None,
37533755
-------
37543756
A new object of same type as caller.
37553757
3756-
Examples
3758+
See Also
37573759
--------
3760+
Series.sample : Returns a random sample of items
3761+
from an axis of object.
3762+
DataFrame.sample : Returns a random sample of items
3763+
from an axis of object.
3764+
Panel.sample : Returns a random sample of items
3765+
from an axis of object.
37583766
3767+
Examples
3768+
--------
37593769
Generate an example ``Series`` and ``DataFrame``:
37603770
37613771
>>> s = pd.Series(np.random.randn(50))

0 commit comments

Comments
 (0)