This is documentation for an old release of NumPy (version 1.6.0). Read this page in the documentation of the latest stable release (version > 1.17).
Counts the number of non-zero values in the array a.
Parameters : | a : array_like
|
---|---|
Returns : | count : int
|
See also
Examples
>>> np.count_nonzero(np.eye(4))
4
>>> np.count_nonzero([[0,1,7,0,0],[3,0,0,2,19]])
5