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

fred fredmfp@gmail....
Sat Jun 13 03:38:39 CDT 2009


josef.pktd@gmail.com a écrit :

> something like this should work to find rows with specific elements,
> if I understand you correctly.
You did ;-)

> np.nonzero(A.view([('',float)]*3) == np.array((1,2,3),[('',float)]*3))[0]
> 
> It creates an extra dimension, that needs to be removed with [0], but
> it takes to long now, to remember how to get rid of it.
Ok, I get it.

Thanks.

BTW, I was thinking this was a FAQ and there was a more straightforward
answer, or a buitlin function to do the trick...


Cheers,

-- 
Fred


More information about the Numpy-discussion mailing list