Let’s see how to calculate standard deviation in Numpy Python module.
Numpy std
Calculating standard deviation in Python is straightforward, and using Numpy makes the process even more convenient.
Numpy provides a dedicated function, std, for calculating standard deviation.
import numpy as np my_array = np.array([1, 5, 7, 5, 43, 43, 8, 43, 6]) standard_deviation = np.std(my_array) print("Standard deviation equals: " + str(round(standard_deviation, 2)))