Skip to content

Commit 4b0bd50

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

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
----------
@@ -3752,10 +3754,18 @@ def sample(self, n=None, frac=None, replace=False, weights=None,
37523754
Returns
37533755
-------
37543756
A new object of same type as caller.
3757+
3758+
See Also
3759+
--------
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.
37553766
37563767
Examples
37573768
--------
3758-
37593769
Generate an example ``Series`` and ``DataFrame``:
37603770
37613771
>>> s = pd.Series(np.random.randn(50))

0 commit comments

Comments
 (0)