5 Advanced Vectorisation Techniques for Improved Python Performance
Use NumPy to speed up your code.
NumPy vectorisation applies a function to an entire array in one call. For example:
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
u = np.sqrt(a) # [1. 1.414 1.732]
v = a + b # [5 7 9]