Skip to content

Commit 4389271

Browse files
author
Nick Eubank
committed
trying to fix error in some builds
1 parent 8b506a3 commit 4389271

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pandas/core/generic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2033,10 +2033,11 @@ def sample(self, n=None, frac=None, replace=False, weights=None, random_state=No
20332033
# If has nan, set to zero. Already know there are no infs.
20342034
weights = weights.fillna(0)
20352035

2036-
20372036
# Check that weights sum to 1. If not, renormalize.
20382037
if weights.sum() != 1:
20392038
weights = weights / weights.sum()
2039+
2040+
weights = weights.values
20402041

20412042
###
20422043
# Process n and frac arguments

pandas/tests/test_generic.py

-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ def test_sample(self):
436436
with tm.assertRaises(ValueError):
437437
s.sample(n=3, weights='weight_column')
438438

439-
440439
# A few dataframe test with degenerate weights.
441440
easy_weight_list = [0]*10
442441
easy_weight_list[5] = 1

0 commit comments

Comments
 (0)