Glossary

NumPy

Also known as: Numerical Python

NumPy (Numerical Python) is the foundational library for numerical and scientific computing in Python. Its core data structure is the ndarray (n-dimensional array): a fixed-size, homogeneously-typed, contiguous block of memory that supports fast element-wise operations, broadcasting, slicing, and linear algebra. NumPy arrays are typically 10–100x faster than Python lists for numerical operations because they avoid per-element type checking and leverage optimised C and Fortran routines.

NumPy provides a comprehensive set of mathematical functions: trigonometric, statistical, linear algebra (numpy.linalg), Fourier transforms (numpy.fft), random number generation (numpy.random), and more. Broadcasting — NumPy's mechanism for applying operations between arrays of different shapes — is one of its most powerful and distinctive features: it lets you add a scalar to an array, multiply a matrix by a vector, or combine arrays of compatible shapes without explicit loops.

NumPy is the foundation on which the entire Python scientific stack is built. pandas, scikit-learn, SciPy, matplotlib, TensorFlow, and PyTorch all use NumPy arrays internally or as their primary interchange format. It is conventionally imported as import numpy as np. Understanding NumPy is a prerequisite for effective work in data science, machine learning, and scientific computing with Python.

Related terms: ndarray, pandas, matplotlib

Discussed in:

This site is currently in Beta. Please email Chris Paton (cpaton@gmail.com) with any suggestions, questions or comments.