NumPy

Last Updated: July 29, 2026 | By Mihail Sebastian | AI Dictionary

The foundation of Python's numerical stack: fast N-dimensional arrays and the mathematical operations that pandas, SciPy, and scikit-learn build on.

What is NumPy?

NumPy is the open-source Python library for numerical computing, built around a fast N-dimensional array that stores data compactly and applies mathematical operations to whole arrays at once. It is the foundation of Python’s data stack.

Pandas builds its tables on NumPy arrays, SciPy runs its scientific algorithms on them, and scikit-learn expects them as input. Whatever data work you do in Python, NumPy is underneath it.

How NumPy Works

A Python list stores every number as a separate object scattered across memory. A NumPy array (the ndarray) stores them as one contiguous block of raw values, so an operation on the whole array runs in compiled C code instead of a Python loop.

This style is called vectorization: write prices * 1.2 and NumPy multiplies every element in one step. Broadcasting extends the idea to arrays of different shapes, and the library adds linear algebra, statistics, and random number generation on top.

NumPy dates to 2005, when Travis Oliphant unified Python’s two competing array libraries into one. Two decades later, its array remains the common data format that the rest of the scientific Python ecosystem agrees on. Even the deep learning frameworks pay tribute: PyTorch and TensorFlow tensors deliberately mirror the NumPy interface.

Example of NumPy

Standardizing a feature before model training takes two lines:

import numpy as np

data = np.array([120, 135, 118, 150, 142])
standardized = (data - data.mean()) / data.std()

The second line subtracts the mean from every element and divides each result by the standard deviation – no loop, no index bookkeeping. The same two lines work unchanged whether data holds five values or fifty million.

Related AI terms: Pandas · SciPy · Scikit-Learn · Vectorization · Tensors

Did you like the NumPy gist?

Learn about 250+ need-to-know artificial intelligence terms in the AI Dictionary.

Mihail Sebastian — Writes about AI governance, regulation, and the technology behind them. Placeholder bio — replace with a real credential line. About

Read the Governor's Letter

Stay ahead with Governor's Letter, the newsletter delivering expert insights, AI updates, and curated knowledge directly to your inbox.

By subscribing to the Governor's Letter, you consent to receive emails from AI Guv.
We respect your privacy - read our Privacy Policy to learn how we protect your information.

Browse All AI Terms A–Z

Every term in the dictionary, in alphabetical order. Jump to a letter or scroll the full list.

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z