DOK.todense

DOK.todense()[source]

Convert this DOK array into a Numpy array.

Returns

The equivalent dense array.

Return type

numpy.ndarray

See also

COO.todense()

Equivalent COO array method.

scipy.sparse.dok_matrix.todense()

Equivalent Scipy method.

Examples

>>> s = DOK((5, 5))
>>> s[1:3, 1:3] = [[4, 5], [6, 7]]
>>> s.todense()  # doctest: +SKIP
array([[0., 0., 0., 0., 0.],
       [0., 4., 5., 0., 0.],
       [0., 6., 7., 0., 0.],
       [0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0.]])