[Numpy-discussion] Find index of repeated numbers in array

Ross Williamson rw247 at astro.columbia.edu
Wed Dec 10 11:38:11 EST 2008


Hi Everyone

I think I'm missing something really obvious but what I would like to  
do is extract the indexes from an array where a number matches - For  
example

data = [0,1,2,960,5,6,960,7]

I would like to know, for example the indices which match 960 - i.e.  
it would return 3 and 6

I could do this with a loop but I was wondering if there was a built  
in numpy function to do this?

BTW if anyone is interested I'm converting some idl code to numpy and  
trying to mmic the IDL function where

Cheers

Ross



More information about the NumPy-Discussion mailing list