dask.array.argwhere
dask.array.argwhere¶
- dask.array.argwhere(a)[source]¶
Find the indices of array elements that are non-zero, grouped by element.
This docstring was copied from numpy.argwhere.
Some inconsistencies with the Dask version may exist.
- Parameters
- aarray_like
Input data.
- Returns
- index_array(N, a.ndim) ndarray
Indices of elements that are non-zero. Indices are grouped by element. This array will have shape
(N, a.ndim)
whereN
is the number of non-zero items.
Notes
np.argwhere(a)
is almost the same asnp.transpose(np.nonzero(a))
, but produces a result of the correct shape for a 0D array.The output of
argwhere
is not suitable for indexing arrays. For this purpose usenonzero(a)
instead.Examples
>>> x = np.arange(6).reshape(2,3) >>> x array([[0, 1, 2], [3, 4, 5]]) >>> np.argwhere(x>1) array([[0, 2], [1, 0], [1, 1], [1, 2]])