COO.nonzero

COO.nonzero()[source]

Get the indices where this array is nonzero.

Returns

idx – The indices where this array is nonzero.

Return type

tuple[numpy.ndarray]

See also

numpy.ndarray.nonzero

NumPy equivalent function

Raises

ValueError – If the array doesn’t have zero fill-values.

Examples

>>> s = COO.from_numpy(np.eye(5))
>>> s.nonzero()
(array([0, 1, 2, 3, 4]), array([0, 1, 2, 3, 4]))