larray.LArray.nonzero

LArray.nonzero()[source]

Returns the indices of the elements that are non-zero.

Specifically, it returns a tuple of arrays (one for each dimension) containing the indices of the non-zero elements in that dimension.

Returns:

tuple of arrays : tuple

Indices of elements that are non-zero.

Examples

>>> arr = ndtest((2, 3)) % 2
>>> arr
a\b  b0  b1  b2
 a0   0   1   0
 a1   1   0   1
>>> arr.nonzero() 
[array([0, 1, 1]), array([1, 0, 2])]