We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5f9a07 commit 18b2876Copy full SHA for 18b2876
pandas/tests/frame/methods/test_sample.py
@@ -137,6 +137,17 @@ def test_sample_inf_weights(self, obj):
137
with pytest.raises(ValueError, match=msg):
138
obj.sample(n=3, weights=weights_with_ninf)
139
140
+ def test_sample_replacement_weight_sum(self, obj):
141
+ # GH#61516
142
+ weights_large_total = [1] * 10
143
+ weights_large_total[0] = 100
144
+ msg = (
145
+ "Invalid weights: If `replace`=False,"
146
+ " unit probabilities have to be less than 1"
147
+ )
148
+ with pytest.raises(ValueError, match=msg):
149
+ obj.sample(n=3, weights=weights_large_total, replace=False)
150
+
151
def test_sample_zero_weights(self, obj):
152
# All zeros raises errors
153
0 commit comments