DOK.nnz¶
-
DOK.
nnz
¶ The number of nonzero elements in this array.
Returns: The number of nonzero elements. Return type: int See also
COO.nnz
- Equivalent
COO
array property. numpy.count_nonzero
- A similar Numpy function.
scipy.sparse.dok_matrix.nnz
- The Scipy equivalent property.
Examples
>>> values = { ... (1, 2, 3): 4, ... (3, 2, 1): 0, ... } >>> s = DOK((5, 5, 5), values) >>> s.nnz 1