[Numpy-discussion] finding index in an array...
fred
fredmfp@gmail....
Sat Jun 13 04:51:12 CDT 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.
Thanks!
Cheers,
--
Fred
More information about the Numpy-discussion
mailing list