NumPy = Numerical Python — foundation for almost all ML libraries.
Provides fast arrays (ndarrays) and math operations — much faster than Python lists.
Install (if needed): pip install numpy
Import convention: import numpy as np
# 1D array
a = np.array([1, 2, 3])
# 2D array (matrix)
b = np.array([[1, 2], [3, 4]])
# Special arrays
zeros = np.zeros(5) # [0. 0. 0. 0. 0.]
ones = np.ones((2, 3)) # 2×3 matrix of 1s
range_arr = np.arange(0, 10, 2) # [0 2 4 6 8]
linspace = np.linspace(0, 1, 5) # [0. 0.25 0.5 0.75 1. ]