


PYTHON APPLIED
NumPy arrays and vectorized math
NumPy is the foundation of scientific Python. Its ndarray stores homogeneous data in contiguous memory, enabling vectorized operations that run orders of magnitude faster than Python loops.
How it reads
np.array([...]) creates a NumPy array from a Python list
temps * 9 / 5 + 32 applies math to every element at once (vectorized)
.mean(), .max(), .std() compute statistics without loops

Cloud tip: NumPy arrays must contain elements of the same type (all ints or all floats). This constraint enables the speed gains.
Check your understanding
Answer all 3 to complete this lesson · +15 XP
1. Why are NumPy arrays faster than Python lists for math operations?
2. What does np.array([1, 2, 3]) * 2 return?
3. Which method computes the average of all elements in a NumPy array?
