Vectorized Math Without Loops
Element-wise operations across whole arrays.
Math on Whole Arrays
With NumPy you rarely write loops for math. You apply an operation to a whole array at once, and every element updates together. ⚡
The Old Loop Way
In plain Python, doubling numbers means looping one by one. It works, but it's verbose and slow for big datasets.
out = []
for x in nums:
out.append(x * 2)All lessons in this course
- From Python List to ndarray
- Shape, Size, and dtype
- Vectorized Math Without Loops
- Indexing and Slicing Arrays