DOK.from_scipy_sparse¶
- classmethod DOK.from_scipy_sparse(x)[source]¶
Create a
DOKarray from ascipy.sparse.spmatrix.- Parameters
x (scipy.sparse.spmatrix) – The matrix to convert.
- Returns
The equivalent
DOKarray.- Return type
Examples
>>> x = scipy.sparse.rand(6, 3, density=0.2) >>> s = DOK.from_scipy_sparse(x) >>> np.array_equal(x.todense(), s.todense()) True