RFC: add count_nonzero
for counting the number of "non-zero" values
#794
Labels
API extension
Adds new functions or objects to the API.
Needs Discussion
Needs further discussion.
RFC
Request for comments. Feature requests and proposed changes.
topic: Statistics
Statistics.
Projects
Milestone
This RFC proposes a new addition to the array API specification for counting the number of "non-zero" (i.e., truthy) values in an array.
Overview
Based on array comparison data, the API is available across all major array libraries in the PyData ecosystem.
count_nonzero
was originally identified in #187 as a potential standardization candidate and has usage within downstream libraries (e.g., sklearn, SciPy).Prior art
keepdims
.keepdims
.keepdims
and was not discussed upon initial addition (ref).Proposal
axis
isNone
, the function should count the number of non-zero elements along a flattened array.Questions
sum
and other reductions, support forkeepdims
is less common among array libraries. Why this is the case is not clear. Are there any reasons whykeepdims
should not be standardized?The text was updated successfully, but these errors were encountered: