-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
FIX value_counts should skip NaT #7424
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
Conversation
Hmm this seems to be explicitly tested for in |
The test was added based on the discussion in #6734. I agree it will be clearer if |
values = values.view(np.int64) | ||
keys, counts = htable.value_count_int64(values) | ||
|
||
from pandas.lib import NaT | ||
msk = keys != NaT.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be comparing vs iNaT
no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's iNaT? (NaT.value == -9223372036854775808).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its the same, but just use: pandas.tslib.iNaT
is the convention
so this makes this consistent with |
@jreback yes, shouldn't be too trick to put something together. I was thinking the same when I was doing this... of some analogous |
yes, |
@hayd looks good...squash and merge |
FIX value_counts should skip NaT
thanks! |
@@ -184,6 +184,8 @@ def value_counts(values, sort=True, ascending=False, normalize=False, | |||
bins : integer, optional | |||
Rather than count values, group them into half-open bins, | |||
convenience for pd.cut, only works with numeric data | |||
dropna : boolean, default False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be True
?
@hayd some comments, but will fix it in a PR |
@jorisvandenbossche thanks! good points! |
fixes #7423
fixes #5569.