NumPy

The array library nearly all scientific Python builds on.

NumPy is taught here in 12 lessons, running from NumPy arrays through to Debugging array code: shape errors and NumPy 2 pitfalls. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.

TrackPython & Data Science
Lessons12
LevelBeginner to intermediate
Reading timeabout 3 hours
PrerequisitesHelpful, but not required: Python 3

Lessons

  1. NumPy arraysWhy ndarray exists, how shapes and dtypes work, and how to create arrays in the ways you will actually use.
  2. Indexing, slicing and masksBasic slicing, views versus copies, boolean masks and fancy indexing — plus the assignment rule that catches everyone.
  3. Vectorised maths and broadcastingElement-wise operations, the ufunc model, aggregation, and the broadcasting rules that make array code concise.
  4. Reshaping, stacking and splittingreshape, transpose, concatenate and split — how to move data between shapes without copying more than necessary.
  5. Views, copies and memory layoutHow NumPy shares memory between arrays, what C and Fortran order really mean, and how to stop copying gigabytes by accident.
  6. Sorting, searching and set operationsSort along the axis you mean, find insertion points without a loop, and use NumPy's set routines for joins and membership.
  7. Linear algebra with numpy.linalgMatrix products, solving systems without inverting them, and the decompositions that answer real questions reliably.
  8. Random number generation with the Generator APIUse default_rng correctly, pick the right distribution, and make results reproducible without poisoning global state.
  9. File I/O: save, load, npz and memory-mapped arraysPersist arrays without losing dtype or shape, read text files robustly, and work with arrays that do not fit in memory.
  10. Structured arrays, datetimes and string dtypesRecord-like arrays, calendar arithmetic with datetime64, and the fixed-width string type that quietly truncates your data.
  11. Performance: einsum, ufunc tricks and avoiding copiesExpress awkward tensor contractions readably, cut temporary allocations with in-place operations, and know when tuned C is worth it.
  12. Debugging array code: shape errors and NumPy 2 pitfallsRead broadcast errors without guessing, find the axis bug, and avoid the numeric and API traps that NumPy 2 introduced.

More in Python & Data Science

Python 3 pandas Matplotlib Jupyter Notebook Flask FastAPI Django SciPy Pillow Python 2.x R Julia

FAQ

How long does the NumPy course take?
It has 12 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for NumPy?
Not strictly. It helps to have read Python 3 first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after NumPy?
Continue with pandas (12 lessons), the next course in Python & Data Science.