Skip to content
masterclass Buddy

NumPy · Function

np.argsort

Returns the indices that would sort an array. It sorts along a chosen axis and can preserve the order of equal values or sort in descending order.

Last updated

Since
2.0.0 for stable; 2.5.0 for descending

Syntax

numpy.argsort(a, axis=-1, kind=None, order=None, *, stable=None, descending=<no value>)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • sort
  • lexsort
  • ndarray.sort
  • argpartition
  • take_along_axis

Source: numpy.argsort — NumPy v2.5 Manual. Checked 2026-11-03.