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

Stéfan van der Walt stefan at sun.ac.za
Mon Jul 13 07:30:49 EDT 2009


2009/7/13 Robert Robert <robertrobert93 at 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