Skip to main content

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]

Submitted by devanshi.srivastava on September 7, 2021

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


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.