argwhere

sparse.argwhere(a)[source]

Find the indices of array elements that are non-zero, grouped by element.

Parameters:

a (array_like) – Input data.

Returns:

index_array

Return type:

numpy.ndarray

See also

where, COO.nonzero

Examples

>>> import sparse
>>> x = sparse.COO(np.arange(6).reshape((2, 3)))
>>> sparse.argwhere(x > 1)
array([[0, 2],
       [1, 0],
       [1, 1],
       [1, 2]])