@@ -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,15 @@ 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.
37583764
3765+ Examples
3766+ --------
37593767 Generate an example ``Series`` and ``DataFrame``:
37603768
37613769 >>> s = pd.Series(np.random.randn(50))
@@ -3794,6 +3802,16 @@ def sample(self, n=None, frac=None, replace=False, weights=None,
37943802 40 0.823173 -0.078816 1.009536 1.015108
37953803 15 1.421154 -0.055301 -1.922594 -0.019696
37963804 6 -0.148339 0.832938 1.787600 -1.383767
3805+
3806+ You can use `random state` for reproducibility:
3807+
3808+ >>> df.sample(random_state=1)
3809+ A B C D
3810+ 37 -2.027662 0.103611 0.237496 -0.165867
3811+ 43 -0.259323 -0.583426 1.516140 -0.479118
3812+ 12 -1.686325 -0.579510 0.985195 -0.460286
3813+ 8 1.167946 0.429082 1.215742 -1.636041
3814+ 9 1.197475 -0.864188 1.554031 -1.505264
37973815 """
37983816
37993817 if axis is None :
0 commit comments