[SciPy-user] Element ranks for an array

Pierre GM pgmdevlist@gmail....
Tue Nov 6 18:10:41 CST 2007

On Tuesday 06 November 2007 18:49:56 R. Padraic Springuel wrote:
> Does scipy have a function that can provide the element ranks by size
> for a 1-d array?
> I.e. a function that would return [3,4,2,1] or [2,1,3,4] (depending on
> ascending or descending ranking) for array([50, 10, 62, 1000]).

For a 1D array

or simply

That'll give you ranking by descending order. Use the [::-1] to get the 

More information about the SciPy-user mailing list