SciPy

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

scipy.sparse.csc_matrix.getnnz

csc_matrix.getnnz(axis=None)[source]

Get the count of explicitly-stored values (nonzeros)

Parameters:

axis : None, 0, or 1

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