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: GH12558 where nulls contributed to normalized value_counts #12566

Closed
wants to merge 1 commit into from

Conversation

kawochen
Copy link
Contributor

@kawochen kawochen commented Mar 9, 2016

@jreback jreback added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Mar 9, 2016
@jreback jreback added this to the 0.18.1 milestone Mar 9, 2016
@@ -43,3 +43,5 @@ Performance Improvements

Bug Fixes
~~~~~~~~~

- Bug in `Series.value_counts` when `normalize=True` and `dropna=True` where nulls still contributed to the normalized count (:issue:`12558`)
Copy link
Contributor

Choose a reason for hiding this comment

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

use double backticks

@kawochen
Copy link
Contributor Author

@nickeubank tests passed. Does this look OK?

d = np.diff(np.r_[idx, len(ids)])
if dropna:
m = ids[lab == -1]
if compat.numpy_compat._np_version_under1p8:
Copy link
Contributor

Choose a reason for hiding this comment

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

from pandas import _np_version_under1p8 (do the import at the top)

@kawochen
Copy link
Contributor Author

done

@nickeubank
Copy link
Contributor

Looks great!

@jreback jreback closed this in f9e5069 Mar 12, 2016
@jreback
Copy link
Contributor

jreback commented Mar 12, 2016

thanks @kawochen @nickeubank

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG?: value_counts(normalize=True) normalizes over all observations including NaN.
3 participants