as_coo¶
- sparse.as_coo(x, shape=None, fill_value=None, idx_dtype=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.asformatA utility function to convert between formats in this library.
COO.from_numpyConvert a Numpy array to
COO.COO.from_scipy_sparseConvert a SciPy sparse matrix to
COO.COO.from_iterConvert an iterable to
COO.