SciPy

This is documentation for an old release of SciPy (version 0.18.1). Read this page in the documentation of the latest stable release (version 1.15.0).

scipy.sparse.csr_matrix.getnnz

csr_matrix.getnnz(axis=None)[source]

Number of stored values, including explicit zeros.

Parameters:

axis : None, 0, or 1

Select between the number of values across the whole matrix, in each column, or in each row.

See also

count_nonzero
Number of non-zero entries