NumPy for scientific Python: dtypes and casting, creation, reshaping, broadcasting, indexing vs views, ufuncs and reductions, linear algebra and einsum, random Generator, I/O, structured arrays, performance and pandas boundaries. Use when writing or reviewing ndarray code. Triggers on numpy, ndarray, broadcasting, dtype, ufunc, einsum, vectorization.
shape, dtype, and memory order (C vs F) before filling arrays; avoid silent astype widening. See reference-arrays-dtypes.md.reshape may view or copy. Mutations alias bugs are common. See reference-indexing-views.md.None / newaxis and np.broadcast_to deliberately. See reference-broadcasting-shape.md.axis and use keepdims=True when broadcasting the result back; prefer np.nanmean etc. when NaNs appear. Mind float summation order for reproducibility. See reference-ufuncs-reductions.md.np.random.Generator (PCG64), not legacy global RandomState, for reproducible science. See reference-random-io-structured.md.| Resource | Role |
|---|---|
| general-python | uv, ruff, ty, vectorization policy, python-reviewer numerics footguns |
| dataframes | Table handoff at boundaries |
| numpy-docstrings | Public API docstrings for array-heavy modules |
| matplotlib-scientific | Plotting array results |
| lab-instrumentation | Binary waveform I/O, instrument-side buffers |
| python-reviewer | dtype/shape/reproducibility in review |
| Topic | File |
|---|---|
Creation, dtype, casting, order, strides | reference-arrays-dtypes.md |
Slicing, fancy index, views, copies, reshape | reference-indexing-views.md |
| Broadcasting, stacking, meshgrid / ogrid | reference-broadcasting-shape.md |
Ufuncs, reductions, axis, where, NaNs | reference-ufuncs-reductions.md |
linalg, @, einsum, tensordot | reference-linalg-einsum.md |
Generator, .npy / .npz, structured dtypes | reference-random-io-structured.md |
| Pandas/Polars handoff, memory, threads | reference-interop-performance.md |
Add or upgrade with uv add numpy per project policy; do not hand-edit pins in pyproject.toml.