Skip to content

Commit 5abfb16

Browse files
committed
fixed comments
1 parent d6179b0 commit 5abfb16

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

pandas/core/groupby/generic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ def value_counts(
726726
ids = ids[changes]
727727
cts = np.diff(np.nonzero(np.r_[changes, True]))[0]
728728
idx = np.r_[0, 1 + np.nonzero(change_ids)[0]]
729-
print(idx)
730729
# how many times each index gets repeated
731730
rep = partial(np.repeat, repeats=np.add.reduceat(changes, idx))
732731

@@ -742,7 +741,6 @@ def value_counts(
742741

743742
if normalize:
744743
num_repeats = np.diff(idx, append=len(change_ids) + 1)
745-
print(num_repeats)
746744
cts = cts.astype("float") / rep(num_repeats)
747745
# each divisor is the number of repeats for that index
748746

pandas/tests/base/test_value_counts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_value_counts_bins_nas(dropna, bins):
207207

208208

209209
def test_value_counts_bins_specific_na():
210-
# verify specific NA example
210+
# GH25970 case where proportions were incorrect for dropna and normalize=True
211211
s2 = Series([1, 2, 2, 3, 3, 3, np.nan, np.nan, 4, 5])
212212
intervals = IntervalIndex.from_breaks([0.995, 2.333, 3.667, 5.0])
213213
expected_dropna = Series([0.375, 0.375, 0.25], intervals.take([1, 0, 2]))

pandas/tests/groupby/test_value_counts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ def rebuild_index(df):
7272
left = gr["3rd"].value_counts(**kwargs)
7373
left.index.names = left.index.names[:-1] + ["3rd"]
7474

75-
# gr = df.groupby(keys, sort=isort)
7675
right = gr["3rd"].apply(Series.value_counts, **kwargs)
7776
right.index.names = right.index.names[:-1] + ["3rd"]
7877

7978
# have to sort on index because of unstable sort on values
8079
left, right = map(rebuild_index, (left, right)) # xref GH9212
80+
8181
# have to ignore 0 counts to be consistent with individual column value_counts
8282
left = left[left.astype(bool)]
8383
right = right[right.astype(bool)]

0 commit comments

Comments
 (0)