Aicloud E-Learning

Guided Notes

Introduction to NumPy

Arrays, and why they're faster than Python lists.

NumPy's core object is the array — a grid of values, all the same type, stored compactly in memory. This makes NumPy operations far faster than the equivalent loop over a plain Python list.

Operations apply element-wise automatically: `arr * 2` doubles every element without writing a loop. This is called vectorization, and it's the whole reason NumPy exists.

Arrays have a shape — a (3, 4) array has 3 rows and 4 columns. Almost every bug when starting out with NumPy traces back to a shape mismatch between two arrays.