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

Stéfan van der Walt stefan@sun.ac...
Mon Jul 13 06:30:49 CDT 2009


2009/7/13 Robert Robert <robertrobert93@yahoo.com>:
> 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.

Try

np.where(x == 3)

Stéfan


More information about the SciPy-user mailing list