NumPy
Open SourceThe fundamental package for scientific computing with Python.
Published 29 May 2026 · Last updated 27 September 2026
Scores
Popularity3/5
Core of Python scientific computing; a transitive dependency for nearly every ML library.
Learning Curve3/5
Array operations are intuitive, but broadcasting rules and axis semantics are non-obvious.
Flexibility4/5
N-dimensional array operations with broadcasting and ufuncs cover a vast range of computations.
Performance4/5
Vectorized C operations run 10-100x faster than equivalent pure Python loops.
Portability5/5
Fundamental Python scientific computing standard; the array API is foundational and universal.
About NumPy
NumPy (Numerical Python) is the foundational array library of scientific Python. It provides the ndarray, a fixed-type multidimensional array stored in contiguous memory, plus a large set of functions that operate on whole arrays at once: arithmetic, linear algebra, Fourier transforms, random number generation, sorting, and statistics. Its core is written in C, so a single vectorised call replaces a slow Python loop.
Two ideas make it expressive. Broadcasting lets arrays of different shapes combine without copying data, and universal functions (ufuncs) apply element-wise operations at compiled speed. Indexing supports slices, boolean masks, and integer ("fancy") indexing, and structured dtypes can hold record-like data.
NumPy is the layer almost every other data and machine learning library is built on: pandas, SciPy, Matplotlib, scikit-learn, and the tensor APIs of PyTorch and JAX all accept or mirror NumPy arrays. The array API standard that NumPy follows is what lets code written against it run on GPU libraries such as CuPy with few changes. Recent 2.x releases focus on free-threaded Python support, typing annotations, and custom dtypes.
NumPy runs on a single machine and on the CPU; GPU work goes to CuPy or JAX, and larger-than-memory arrays to Dask or Zarr. It is free and open source under the BSD licence, installed with pip or conda, and maintained by a community project fiscally sponsored by NumFOCUS.
Key Features
- N-dimensional array object (ndarray) with typed, contiguous memory
- Broadcasting for arithmetic on arrays of different shapes
- Universal functions (ufuncs) for element-wise operations at compiled speed
- Linear algebra, Fourier transform, and statistical routines
- Random number generation through the Generator API
- Slicing, boolean masks, and fancy indexing
- C API and interoperability with C, C++, and Fortran code
Pros
- Vectorised, C-backed operations are far faster than pure Python loops
- Broadcasting keeps multi-dimensional code short and readable
- The common base layer: nearly every Python data and ML library accepts NumPy arrays
- Thorough documentation and a large community
- Permissive BSD licence, free for any use
Cons
- CPU only; GPU workloads need CuPy or JAX
- Single machine and in-memory; larger-than-RAM data needs Dask or Zarr
- Arrays hold one dtype, so mixed-type tabular data belongs in pandas or Polars
- Major version upgrades (such as 1.x to 2.x) can break older code
NumPy Pricing
Open SourceTech Stacks with NumPy
Tools Related to NumPy
Works well with NumPy(8)
scikit-learn's entire API is built on NumPy arrays — all estimators accept and return ndarrays; the two are effectively inseparable in classical ML workflows.
Pandas is built on NumPy arrays — DataFrame column operations delegate to NumPy; the two are co-dependent at the Python data science layer.
PyTorch tensors and NumPy arrays share memory via zero-copy interop (.numpy()/.from_numpy()) — the two are freely interchangeable in most ML pipelines.
NumPy arrays are the standard interchange format between TensorFlow and the rest of the Python data stack — TF tensors can be created from and converted back to NumPy arrays.
Dash uses NumPy arrays for computation; Plotly (Dash's rendering layer) natively accepts NumPy arrays in figure definitions.
Panel's plotting components consume NumPy arrays directly, enabling high-performance data visualization dashboards with HoloViews.
Built on (1)
NumPy is the fundamental Python package for numerical computing.