COO.from_numpy¶
-
classmethod
COO.
from_numpy
(x)[source]¶ Convert the given
numpy.ndarray
to aCOO
object.Parameters: x (np.ndarray) – The dense array to convert. Returns: The converted COO array. Return type: COO Examples
>>> x = np.eye(5) >>> s = COO.from_numpy(x) >>> s <COO: shape=(5, 5), dtype=float64, nnz=5, sorted=True, duplicates=False>