Name

nonzero

Synopsis

nonzero(a)

Returns the indices of those elements of a that are not equal to 0, like the expression:

array([i for i in range(len(a)) if a[i] != 0])

a must be a sequence or one-dimensional array.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.