Let’s see how to calculate standard deviation in Numpy Python module.
Numpy std
It is very easy to calculate a standard deviation in Python. With Numpy it is even easier.
There is a dedicated function in the Numpy module to calculate a 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)))