Lesson 13 of 60
pythonAdvanced NumPy: Masking, Fancy Indexing, and Structured Arrays
25 minutes
Course progress22%
Advanced NumPy Techniques
When working with real data, you often need to filter, reshape, or work with heterogeneous structures.
Boolean masking (filtering)
arr = np.arange(20)
mask = (arr % 3 == 0) & (arr > 5)
filtered = arr[mask]
print(filtered) # [6 9 12 15 18]