scipy.sparse.dia_matrix.getnnz

dia_matrix.getnnz()

number of nonzero values

explicit zero values are included in this number

This Page