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.


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


import numpy as np
#It is used to returns the indices that would sort an array.

Output: [5 2 1 4 3 0]

Tue, 09/07/2021 - 20:00

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.