NumPy
The fundamental package for scientific computing with Python
NumPy 2.2.0 released!
2024-12-08
Powerful N-dimensional arrays
Fast and versatile, the NumPy vectorization, indexing, and broadcasting concepts are the de-facto standards of array computing today.
Numerical computing tools
NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more.
Open source
Distributed under a liberal BSD license, NumPy is developed and maintained publicly on GitHub by a vibrant, responsive, and diverse community.
Interoperable
NumPy supports a wide range of hardware and computing platforms, and plays well with distributed, GPU, and sparse array libraries.
Performant
The core of NumPy is well-optimized C code. Enjoy the flexibility of Python with the speed of compiled code.
Easy to use
NumPy’s high level syntax makes it accessible and productive for programmers from any background or experience level.
Try NumPy

Use the interactive shell to try NumPy in the browser

""" To try the examples in the browser: 1. Type code in the input cell and press Shift + Enter to execute 2. Or copy paste the code, and click on the "Run" button in the toolbar """ # The standard way to import NumPy: import numpy as np # Create a 2-D array, set every second element in # some rows and find max per row: x = np.arange(15, dtype=np.int64).reshape(3, 5) x[1:, ::2] = -99 x # array([[ 0, 1, 2, 3, 4], # [-99, 6, -99, 8, -99], # [-99, 11, -99, 13, -99]]) x.max(axis=1) # array([ 4, 8, 13]) # Generate normally distributed random numbers: rng = np.random.default_rng() samples = rng.normal(size=2500) samples

ECOSYSTEM

Nearly every scientist working in Python draws on the power of NumPy.

NumPy brings the computational power of languages like C and Fortran to Python, a language much easier to learn and use. With this power comes simplicity: a solution in NumPy is often clear and elegant.

CASE STUDIES