[SciPy-user] Returning the positions of a sorted array

Steve Lianoglou lists.steve@arachnedesign....
Wed Sep 19 06:26:55 CDT 2007


> But what if i want the actual original positions of the sorted  
> array to be returned instead. Is there a command in python that can  
> do this?
> I'm looking for an answer of the form [2,0,1] which returns the  
> original positions in a of the sorted array instead.

Look at the numpy.argsort function. That'll do the trick.


More information about the SciPy-user mailing list