NumPy Tutorial with Examples.
NumPy tutorial with runnable examples: arrays, broadcasting, linear algebra, Fourier transforms and performance patterns for numerical computing.
Beginner
Start here — no prior experience needed
NumPy Learning Roadmap
A structured path from NumPy beginner to expert — with milestones, time estimates, and what to build at each stage.
Introduction to NumPy
Why NumPy exists: measure a Python list against an ndarray for memory and speed, install NumPy, and inspect your first array's dtype and shape.
Creating NumPy Arrays
Create NumPy arrays from lists, ranges, linspace, zeros, ones, full, eye and random generators, and see the float-step arange trap with real output.
NumPy Indexing and Slicing
Index, slice, mask and fancy-index NumPy arrays, and learn exactly which operations return views and which return copies, proven with np.shares_memory.
NumPy Universal Functions (ufuncs)
Use NumPy ufuncs, axis aggregations, statistics, sorting, top-k and set operations with real output, including NaN handling and the removed np.in1d.
NumPy Projects
Hands-on projects to solidify your NumPy skills — from basic array manipulation to building ML algorithms from scratch.
Intermediate
For developers with core concepts down
NumPy Broadcasting
Learn NumPy's broadcasting rules with real output: scalars, row and column vectors, np.newaxis, pairwise distances, and the shape errors when rules fail.
NumPy Vectorization
Replace Python loops with vectorized NumPy: formulas, returns, np.where, np.select, sliding windows, and a measured look at why np.vectorize isn't fast.
NumPy Matrix Operations
NumPy matrix multiplication with @, transpose, reshape with -1, stacking and splitting, plus the real shape errors each raises when dimensions don't fit.
NumPy Structured Arrays
Store heterogeneous, named-field records in one NumPy array — read them from CSV, round-trip to disk, and access fields by name.
NumPy Random and Simulation
Generate reproducible random numbers with default_rng, sample distributions, run Monte Carlo estimates, bootstrap intervals, and spawn independent streams.
Advanced
Production-grade patterns for experienced engineers
NumPy Linear Algebra
Solve linear systems, fit least squares, compute eigenvalues, SVD-based PCA and condition numbers with np.linalg, and measure why solve beats inv.
NumPy Performance Optimization
Measure NumPy performance for real: timeit and tracemalloc, float32 vs float64, memory layout, out= buffers, einsum, and a dtype claim NumPy 2 disproves.