Skip to content

Commit fb89d13

Browse files
committed
minior fixes
1 parent 8d3d11c commit fb89d13

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/source/user_guide/indexing.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ as a string.
712712

713713
.. ipython:: python
714714
715+
1/0
715716
df2 = pd.DataFrame({'col1': [9, 8, 7, 6],
716717
'weight_column': [0.5, 0.4, 0.1, 0]})
717718
df2.sample(n=3, weights='weight_column')

pandas/core/sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def sample(
150150
else:
151151
raise ValueError("Invalid weights: weights sum to zero")
152152

153-
is_max_weight_dominating = size * max(weights) > 1
153+
is_max_weight_dominating = size * weights.max() > 1
154154
if is_max_weight_dominating and not replace:
155155
raise ValueError(
156156
"Invalid weights: If `replace`=False, "

0 commit comments

Comments
 (0)