COO
SparseArray.
density
The ratio of nonzero to all elements in this array.
See also
COO.size
COO.nnz
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