Skip to content

Commit 46f7059

Browse files
committed
update doc
1 parent 4382def commit 46f7059

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,7 @@ Other
905905
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` throwing ``ValueError`` when ``regex=True`` and all NA values. (:issue:`60688`)
906906
- Bug in :meth:`Series.to_string` when series contains complex floats with exponents (:issue:`60405`)
907907
- Bug in :meth:`read_csv` where chained fsspec TAR file and ``compression="infer"`` fails with ``tarfile.ReadError`` (:issue:`60028`)
908+
- Bug in :meth:`DataFrame.sample` with ``replace=False`` and sum of weights greater than 1, the method would return biased results. Now raises ``ValueError``. (:issue:`61516`)
908909
- Bug in Dataframe Interchange Protocol implementation was returning incorrect results for data buffers' associated dtype, for string and datetime columns (:issue:`54781`)
909910
- Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
910911
- Bug in ``Series.list`` methods not preserving the original name. (:issue:`60522`)

pandas/core/generic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5815,6 +5815,8 @@ def sample(
58155815
If weights do not sum to 1, they will be normalized to sum to 1.
58165816
Missing values in the weights column will be treated as zero.
58175817
Infinite values not allowed.
5818+
When replace = False will not allow weights that add up to less
5819+
than 1, to avoid biased results.
58185820
random_state : int, array-like, BitGenerator, np.random.RandomState, np.random.Generator, optional
58195821
If int, array-like, or BitGenerator, seed for random number generator.
58205822
If np.random.RandomState or np.random.Generator, use as given.

0 commit comments

Comments
 (0)