Importing
Creating arrays
Arithmetic
numpy-ts does not overload JavaScript operators. Use
np.add(a, b) or a.add(b) instead of a + b. Method chaining (.add(), .reshape(), etc.) is available on NDArray from the full entry point. See Tree-Shaking & Bundle Size for details on the two entry points.Indexing and slicing
This is the biggest syntax change. Python uses bracket notation with colons; numpy-ts uses a.slice() method with string arguments.
Slicing syntax reference
Reshaping
Reductions
Linear algebra
Random
As of v1.2.0,
numpy-ts uses the same RNGs as NumPy (MT19937 for the legacy API, PCG64 for the modern API). Random outputs now match NumPy exactly for all distributions given the same seed.FFT
File I/O
Common gotchas
Supported dtypes
numpy-ts supports 14 data types that map to JavaScript TypedArrays:What about missing NumPy features?
numpy-ts covers 476 of 507 NumPy functions (94%). A few categories have partial coverage:- Structured arrays / record dtypes — not supported (JS has no equivalent)
- String operations (
np.char) — not supported (use native JS string methods) np.ma(masked arrays) — not supported yetnp.matrix— deprecated in NumPy itself; use 2DNDArrayinstead
Next steps
Quickstart
Hands-on tutorial covering all major features.
API Reference
Complete function reference organized by category.
Tree-Shaking
Full library vs core: which entry point is right for you?