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]
ββ run Β· ββ β nav
βΆ Output
Run your code to see output here.