0 / 34
Lesson 18

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.