SparseArray.todense¶
- abstract SparseArray.todense()[source]¶
Convert this
SparseArrayarray to a densenumpy.ndarray. Note that this may take a large amount of memory and time.- Returns
The converted dense array.
- Return type
See also
DOK.todenseEquivalent
DOKarray method.COO.todenseEquivalent
COOarray method.scipy.sparse.coo_matrix.todenseEquivalent Scipy method.
Examples
>>> import sparse >>> x = np.random.randint(100, size=(7, 3)) >>> s = sparse.COO.from_numpy(x) >>> x2 = s.todense() >>> np.array_equal(x, x2) True