NumPy arrays store same-typed values in contiguous memory and run operations in compiled C code (vectorization), avoiding Python-level loops.
import numpy as np
x = np.arange(1_000_000)
y = x * 2 + 1 # vectorized, no loopNumPy arrays store same-typed values in contiguous memory and run operations in compiled C code (vectorization), avoiding Python-level loops.
import numpy as np
x = np.arange(1_000_000)
y = x * 2 + 1 # vectorized, no loop