COO
COO.
density
The ratio of nonzero to all elements in this array.
The ratio of nonzero to all elements.
float
See also
COO.size
Number of elements.
COO.nnz
Number of nonzero elements.
Examples
>>> import numpy as np >>> from sparse import COO >>> x = np.zeros((8, 8)) >>> x[0, :] = 1 >>> s = COO.from_numpy(x) >>> s.density 0.125