SparseArray.todense

SparseArray.todense()[source]

Convert this SparseArray array to a dense numpy.ndarray. Note that this may take a large amount of memory and time.

Returns

The converted dense array.

Return type

numpy.ndarray

See also

DOK.todense()

Equivalent DOK array method.

COO.todense()

Equivalent COO array method.

scipy.sparse.coo_matrix.todense()

Equivalent 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