-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
np.count_nonzero() should accept axis parameter #391
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
Comments
Sounds reasonable. |
I wrote this elsewhere, but if no one else wants to try it, I can go on an "add axis" spree: I have working code for bincount (will try to make it into a PR tonight), and have searchsorted, interp, and now count_nonzero in the pipeline. Is there any other obvious one I am forgetting about? |
Any news on this? I'd be interested in this feature as well. |
an alternative might be to try and adapt sum(bool) to use the much faster non-casting count_nonzero code. |
I am unsure if the ufunc reduce supports mixed type inner loops. |
+1 for adding an |
+1 here as well. |
Also +1 here. |
+1 |
feat: Add vmaxv[q]_[s8|s16|s32|u8|u16|u32|f32|f64]
Currently, np.count_nonzero() accepts only the input array. I propose adding
axis
parameter similar to that of functions np.sum() and np.max() etc.I think the alternative
(A != 0).sum(axis=rows_or_cols)
isn't as clear.The text was updated successfully, but these errors were encountered: