[Numpy-discussion] finding nonzero elements in list
per freem
perfreem@gmail....
Mon Oct 12 09:18:44 CDT 2009
hi all,
i'm trying to find nonzero elements in an array, as follows:
a = array([[1, 0],
[1, 1],
[1, 1],
[0, 1]])
i want to find all elements that are [1,1]. i tried: nonzero(a ==
[1,0]) but i cannot interpret the output. the output i get is:
(array([0, 0, 1, 2]), array([0, 1, 0, 0]))
i simply want to find the indices of the elements that equal [1,0].
how can i do this? thanks.
More information about the NumPy-Discussion
mailing list