Numpy argsort - what is it doing?

Why is numpy giving this result:

    x = numpy.array([1.48,1.41,0.0,0.1])
    print x.argsort()

    >[2 3 1 0]

when I'd expect it to do this:

[3 2 0 1]

Clearly my understanding of the function is lacking.

According to the documentation

Returns the indices that would sort an array.

  • 2 is the index of 0.0.
  • 3 is the index of 0.1.
  • 1 is the index of 1.41.
  • 0 is the index of 1.48.

From: stackoverflow.com/q/17901218

Back to homepage or read more recommendations: