Back to Numerical Arrays (NumPy)
np.nonzero
Find indices of nonzero elements.
Syntax
np.nonzero(arr)
Description
Find indices of nonzero elements. Returns a 2D array of shape (num_nonzero, ndim) where each row contains the multi-dimensional index of a nonzero element.
Parameters
| Name | Description |
|---|---|
| arr | - Input array |
Returns
Promise<NDArray>