[Numpy-discussion] finding index in an array...

fred fredmfp at gmail.com
Sat Jun 13 05:51:12 EDT 2009

Emmanuelle Gouillart a écrit :
> Hi Fred,
Hi Manue ;-)

> here is another solution
>>>> A = np.arange(99).reshape((33,3)
>>>> mask = (A==np.array([0,1,2]))
>>>> np.nonzero(np.prod(mask, axis=1))[0]
> array([0]
> I found it to be less elegant than Josef's solution changing the dtype of
> the array, but it may be easier to understand if you're not very familiar
> with dtypes. 
I have no problem.

> Also, it is a bit faster on my computer:
I take it.




More information about the NumPy-Discussion mailing list