finds.dev

rougier/from-python-to-numpy

An open-access book on numpy vectorization techniques, Nicolas P. Rougier, 2017

View on GitHubHomepage ↗

★ 2,154PythonNOASSERTIONupdated May 2025

// the take

A free 2017 online book by a computational neuroscientist on thinking in numpy terms instead of writing Python loops, built around worked case studies (boid flocking, Game of Life, Mandelbrot, a smoke solver) rather than API reference. Aimed at developers who already know numpy's syntax but still default to for-loops and want a framework for when and how to vectorize.

The code/problem/custom vectorization taxonomy is a real contribution — most numpy writeups show the trick, this one explains which category of trick applies and why, which is the part people actually get stuck on. Every case study ships a working python-loop version next to the numpy version in code/, so you can diff them directly instead of taking the author's word for the speedup. It's genuinely free with no email gate, just RST source plus a prebuilt book.html you can read offline.

Content hasn't moved since 2017 — no mention of numpy's newer array API, no discussion of numba/cupy as alternatives once 'custom vectorization' stops paying off, and some strides/np.vectorize advice is dated relative to current numpy internals. CC BY-NC-SA blocks commercial reuse, so a team can't fold chapters into internal onboarding docs without asking. There are no notebooks, only RST and static scripts, so there's no inline way to run an example without cloning the repo and executing it yourself. It's a straight read with no exercises, so it teaches by example rather than by practice.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,154
Forks
351
Language
Python
License
NOASSERTION
Last commit
6 May 2025

// nearby

If from-python-to-numpy isn't quite it.

All repos →