0 / 34

Invite others

Progress

0 / 34

Sorting & Searching

np.argsort returns indices that would sort:

order = np.argsort(a)
sorted = a[order]
Why this matters

Sorting values is common; argsort is for when you need rank order or must reorder parallel arrays (labels, scores, timestamps) by the same permutation—without losing alignment.

Search functions like searchsorted build on the same ordered-array mental model.

ResourcesDocs, references & more — opens in a new tab
🎯 Your Task

data = [50,10,40,20,30]. order = np.argsort(data). sorted_data = data[order].

order = np.argsort(data)
exercise.py
⌘⏎ run · ⌘← → nav
Output
Run your code to see output here.