as_coo¶
-
sparse.as_coo(x, shape=None, fill_value=None)[source]¶ Converts any given format to
COO. See the “See Also” section for details.- Parameters
x (SparseArray or numpy.ndarray or scipy.sparse.spmatrix or Iterable.) – The item to convert.
shape (tuple[int], optional) – The shape of the output array. Can only be used in case of Iterable.
- Returns
out – The converted
COOarray.- Return type
See also
SparseArray.asformat()A utility function to convert between formats in this library.
COO.from_numpy()Convert a Numpy array to
COO.COO.from_scipy_sparse()Convert a SciPy sparse matrix to
COO.COO.from_iter()Convert an iterable to
COO.