Skip to content

Commit 6a4042e

Browse files
committed
doc fix
1 parent 8c1dae3 commit 6a4042e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/source/user_guide/indexing.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,15 @@ as a string.
712712

713713
.. ipython:: python
714714
715-
print("to fix")
715+
df2 = pd.DataFrame({'col1': [9, 8, 7, 6],
716+
'weight_column': [0.5, 0.4, 0.1, 0]})
717+
df2.sample(n=2, weights='weight_column')
716718
717719
``sample`` also allows users to sample columns instead of rows using the ``axis`` argument.
718720

719721
.. ipython:: python
720722
721-
df3 = pd.DataFrame({'col1': [1, 2, 3], 'col2': [2, 3, 4]})
722-
df3.sample(n=1, axis=1)
723+
print("a")
723724

724725
Finally, one can also set a seed for ``sample``'s random number generator using the ``random_state`` argument, which will accept either an integer (as a seed) or a NumPy RandomState object.
725726

0 commit comments

Comments
 (0)