Skip to content

Commit 2a9c91d

Browse files
author
Nick Eubank
committed
weight tweaks
1 parent 74debcc commit 2a9c91d

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

doc/source/whatsnew/v0.16.1.txt

+2-6
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,13 @@ for passing in a column for weights for non-uniform sampling, and for setting se
169169

170170

171171
When applied to a DataFrame, one may pass the name of a column to specify sampling weights
172-
when sampling from rows (thought row names may not be passed to sample from rows).
172+
when sampling from rows.
173173

174174
.. ipython :: python
175175

176-
df = DataFrame({'col1':[9,8,7,6], 'weight_column':[0.5, 0.4, 0.1, 0]}, index=['a', 'b', 'c', 'd'])
176+
df = DataFrame({'col1':[9,8,7,6], 'weight_column':[0.5, 0.4, 0.1, 0]})
177177
df.sample(n=3, weights='weight_column')
178178

179-
df.sample(n=3, weights='weight_column', axis = )
180-
181-
182-
183179
.. _whatsnew_0161.api:
184180

185181
API changes

pandas/tests/test_generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def test_sample(self):
439439
df = pd.DataFrame({'col1':range(10,20),
440440
'col2':range(20,30),
441441
'colString': ['a']*10,
442-
'easyweights':easy_weight_list}, index = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'])
442+
'easyweights':easy_weight_list})
443443
sample1 = df.sample(n=1, weights='easyweights')
444444
assert_frame_equal(sample1, df.iloc[5:6])
445445

0 commit comments

Comments
 (0)