COO.from_scipy_sparse¶
-
classmethod
COO.
from_scipy_sparse
(x)[source]¶ Construct a
COO
array from ascipy.sparse.spmatrix
Parameters: x (scipy.sparse.spmatrix) – The sparse matrix to construct the array from. Returns: The converted COO
object.Return type: COO Examples
>>> x = scipy.sparse.rand(6, 3, density=0.2) >>> s = COO.from_scipy_sparse(x) >>> np.array_equal(x.todense(), s.todense()) True