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 1f6f42a commit e447dd4Copy full SHA for e447dd4
pandas/tests/frame/methods/test_sample.py
@@ -137,6 +137,14 @@ 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 = "Invalid weights: If `replace`=False weights must sum to less than 1"
145
+ with pytest.raises(ValueError, match=msg):
146
+ obj.sample(n=3, weights=weights_large_total, replace=False)
147
+
148
def test_sample_zero_weights(self, obj):
149
# All zeros raises errors
150
0 commit comments