NumPy: Sorting Arrays Using argsort()

It is used to return the indices that would sort an array.
It performs an indirect sorting along the specified axis and kind keyword. It returns an array of indices of the same shape as that index data along the given axis in sorted order.

Syntax:

numpy.argsort(a, axis=- 1, kind=None, order=None)

Example:

import numpy as np
marks=np.array([80,50,20,70,60,10])
b=np.argsort(marks,axis=0)
#It is used to returns the indices that would sort an array.
print(b)

Output: [5 2 1 4 3 0]