NumPy Tutorial
Master NumPy from scratch with our comprehensive, interactive curriculum — 50 lessons from Beginner to Advanced.
Learn NumPy from scratch — ndarrays, indexing, broadcasting, ufuncs, linear algebra and vectorized performance — free interactive lessons.
Part of the free Numpy course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
👋 New to NumPy? Some Python is all you need.
Start with Lesson 1 and build real numerical-computing skills step by step — at your own pace.
Lessons in this course
- Introduction to NumPy — What NumPy is, why it's fast, and how to install and import it
- The ndarray: NumPy's Core Object — Understand the n-dimensional array that powers all of NumPy
- Creating Arrays (array, zeros, arange, linspace) — Build arrays from lists and with built-in constructors
- Array Data Types (dtypes) — Control memory and precision with int32, float64, bool and more
- Array Attributes: shape, ndim, size — Inspect the structure of any array with its key attributes
- Indexing and Slicing Arrays — Access and modify elements, rows, columns, and sub-grids
- Boolean & Fancy Indexing — Select elements with masks and integer index arrays
- Reshaping and Flattening — Change array shape with reshape, ravel, flatten, and transpose
- Element-wise Operations & Universal Functions — Apply fast vectorized math with ufuncs like add, sqrt, and exp
- Broadcasting Explained — Operate on arrays of different shapes without writing loops
- Aggregations: sum, mean, axis — Summarize data along rows and columns with the axis argument
- Stacking & Splitting Arrays — Combine and divide arrays with stack, concatenate, and split
- Copies vs Views — Know when slicing shares memory and when it copies data
- Random Number Generation — Generate reproducible random data with the modern Generator API
- Linear Algebra with numpy.linalg — Solve systems, find determinants, inverses, and eigenvalues
- Matrix Operations & Dot Products — Multiply matrices with dot and the @ operator
- Conditions: where, select, clip — Build new arrays from conditional logic without loops
- Sorting, Searching & Counting — Order data and find values with sort, argsort, and searchsorted
- Structured & Record Arrays — Store tabular data with named, typed fields in one array
- File I/O: save, load, savetxt — Persist arrays to .npy, .npz, and text files
- Performance & Vectorization vs Loops — Replace slow Python loops with fast vectorized NumPy code
- Splitting Arrays: split, hsplit & vsplit — Divide one array into many with split, hsplit, vsplit, and array_split
- The axis Parameter Explained — Finally understand axis=0 vs axis=1 and keepdims on multi-dimensional arrays
- Fancy Indexing with Integer Arrays — Select and reorder elements with arrays of integer indices
- Handling NaN & Infinity — Detect and survive NaN and inf with isnan, isfinite, and nan-aware reductions
- Unique Values & Counting — Find and tally distinct values with unique, bincount, and count_nonzero
- Set Operations on Arrays — Compare arrays with intersect1d, union1d, setdiff1d, and isin
- Rounding & Clipping — Round, floor, ceil, and constrain values into a range with clip
- Cumulative & Difference Functions — Build running totals and deltas with cumsum, cumprod, and diff
- Checkpoint: Array Operations — Combine axis reductions, fancy indexing, NaN handling and set ops — then a quiz
- meshgrid & Coordinate Grids — Build coordinate grids to evaluate functions over a 2D plane
- Repeating Arrays: tile & repeat — Duplicate data with tile and repeat — and know the difference
- Adding Axes: newaxis & expand_dims — Reshape for broadcasting by inserting and squeezing size-1 dimensions
- Transposing & Swapping Axes — Reorder dimensions with .T, transpose, swapaxes, and moveaxis
- Dates & Times with datetime64 — Do date arithmetic with datetime64 and timedelta64 and their units
- Polynomials: polyfit & poly1d — Fit and evaluate polynomials with polyfit, poly1d, polyval, and roots
- Vectorizing Python Functions — Apply Python functions over arrays with vectorize and apply_along_axis
- Einstein Summation: einsum — Express dot products, matmuls, transposes, and traces with one notation
- Checkpoint: Numerical Computing — Combine grids, polynomial fits and einsum in a build — then a quiz
- Masked Arrays (np.ma) — Flag and skip invalid entries with masked arrays and masked reductions
- Fourier Transforms (np.fft) — Analyse frequency content of signals with the FFT and rfft
- Interpolation (np.interp) — Estimate values between known data points with linear interpolation
- Histograms & Binning — Bin and count data with histogram, digitize, and bincount
- Memory Layout & Strides — C vs Fortran order, strides, and why contiguity affects speed
- ufunc Methods (reduce, accumulate, outer) — Unlock reduce, accumulate, outer, and at on any universal function
- Statistics (percentile, median, std) — Summaries, percentiles, correlation and covariance along an axis
- Linear Algebra: solve, svd, eig — Solve systems and decompose matrices with numpy.linalg
- NaN-Aware Functions (nanmean, nansum) — Compute statistics that ignore NaN instead of poisoning the result
- Checkpoint: Scientific Computing — Combine histograms, robust stats and linear algebra in a build — then a quiz
- Capstone: Image as an Array — Treat an image as a 3D array and manipulate its pixels