-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Feature request: Option to include NaNs in value_counts() #5569
Comments
to be clear, you can already do this: The problem is that you'd end up with an Index with |
Yes, I know the workaround, but I would like to see it solved for value_counts, because it is a relevant piece of information for the scope of value_counts. |
this is trivial to implement and the Index with so we're down to a design decision. To me, |
I wouldn't include it by default as well. But it is extremely helpful to have in one overview what the rough ratio is between successful measurements with values and nans.
I immediately know that something went wrong, which I wouldn't suspect if I don't see the nans. When I have to do this without the nans, I first have to sum up all the real values and compare it to the length of series, it's always one more step to do. Sure, I can write my own wrapper, but I thought it's a useful feature to have it at least as an option to the value_counts call. |
well, |
I have never used 'mode' and don't understand what it does. In my case: print df.marking.mode()
print
print df.marking.value_counts()
0 blotch
dtype: object
blotch 3854641
fan 3192799
None 2785831
interesting 884843
dtype: int64 I cheated by replacing nans by |
From my experience, it is very helpful for I work in a SAS shop, but I'm moving all of my analysis and reporting work from SAS to Python. I use I've got to believe I'm nowhere near the only person who needs to see frequency counts for SAS does not report missing values in frequency reports by default, but I'm OK with always selecting that option when I run I do know how to add the missing counts to my |
+1 will fix along with #7424. |
Something similar is in #7217. If NaN is a problem in index, this will also come up in Categoricals: jreback@725a497 |
|
I find it highly valuable to also receive the information how many NaN values are in my Series.
Could we have an option in value_counts(), maybe
include_nans=True
that would add a count for those in the output of it?The text was updated successfully, but these errors were encountered: