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
numpy-ts currently uses different RNGs than NumPy. This means that the generated random numbers will not match NumPy’s output, even with the same seed. Statistical properties (distributions, means, variances) will be the same, but exact sequences will differ.FFT
File I/O
Common gotchas
Supported dtypes
numpy-ts supports 13 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?