NumPy
NumPy is the core Python library for numerical computing. It provides fast, multi-dimensional arrays and math operations that power nearly all data science and machine learning tools.
Data & AI
NumPy's array (ndarray) lets you do math on whole collections of numbers at once, far faster than Python lists. Operations like adding two arrays or multiplying matrices run in optimized C code under the hood.
It's the foundation that pandas, scikit-learn, and deep learning frameworks are built on. It's usually imported with the alias 'np'. Working with arrays element-by-element without writing loops is called vectorization.
Examples
Python
import numpy as np
a = np.array([1, 2, 3])
print(a * 2)
print(a.mean())Output:
[2 4 6]
2.0