Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: value_count(normalize=True, dropna=True) counting missing in denominator, #12558 #12576

Closed
wants to merge 3 commits into from

Conversation

nickeubank
Copy link
Contributor

Closes #12558

@jreback jreback added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Mar 9, 2016
@@ -342,7 +343,10 @@ def value_counts(values, sort=True, ascending=False, normalize=False,
result = result.sort_values(ascending=ascending)

if normalize:
result = result / float(values.size)
if dropna:
result = result / float(values[notnull(values)].size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Series(values).count()

@jreback jreback changed the title fixes 12558 - value_count(normalize=True, dropna=True) counting missing in denominator BUG: value_count(normalize=True, dropna=True) counting missing in denominator, #12558 Mar 9, 2016
@kawochen
Copy link
Contributor

kawochen commented Mar 9, 2016

#12566 fixes this too, will need to fix groupby. Lemme know if you wanna work on this and I'll close mine.

@nickeubank
Copy link
Contributor Author

@kawochen Oops! Sorry, did not mean to double up. If you have this covered I can close -- not sure what you mean about groupby.

@kawochen
Copy link
Contributor

groupby has a version of value_counts. I fixed it for numpy > 1.8 and have an idea for older versions. Lemme play around with it tonight (EST). If it doesn't work I'll close it and let you have fun :)

@nickeubank
Copy link
Contributor Author

@kawochen Sounds good! Just let me know.

@nickeubank nickeubank closed this Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants