0 / 34
Lesson 6

Boolean Indexing

Filter with conditions:

a = np.array([15, 22, 8, 41, 3, 30])
a[a > 20]  # [22, 41, 30]
Why this matters

Boolean masks are how you express filters in one expression: keep rows that pass a test, drop noise, or tag outliersβ€”without slow Python loops over elements.

This pattern is the NumPy side of what becomes .loc with boolean Series in pandas.

ResourcesDocs, references & more β€” opens in a new tab
🎯 Your Task

Given scores = np.array([45,82,91,67,55,98,73,88]), create passing with scores β‰₯ 70.

scores[scores >= 70]
exercise.py
⌘⏎ run Β· βŒ˜β† β†’ nav
β–Ά Output
Run your code to see output here.