[SciPy-user] retrieve indexes of 2D array element

David Warde-Farley dwf@cs.toronto....
Mon Jul 13 02:11:05 CDT 2009


On 13-Jul-09, at 2:56 AM, Robert Robert wrote:

> Hi all,
> I have a 2D scipy array of integer. I can not figure out how to  
> retrieve the indexes i, j of a specific element in the array. I can  
> loop through the array in python and search for it, but I can not  
> believe that scipy does not have a highly optimized algorithm.
> Thanks,
> robert


By a specific element, do you mean a certain value? If so use a  
boolean condition and where().

http://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html

David


More information about the SciPy-user mailing list