Standard Deviation
Standard Deviation in NumPy

There is a NumPy function dedicated to finding the standard deviation of a dataset — we can cut out the step of first finding the variance. The NumPy function std() takes a dataset as a parameter and returns the standard deviation of that dataset:

import numpy as np dataset = [4, 8, 15, 16, 23, 42] standard_deviation = np.std()



We’ve removed the code that calculated the variance of each dataset. By using np.std() we don’t need to take that middle step anymore.

Call np.std() using nba_data as a parameter, and store the result in nba_standard_deviation.

Make a similar function call using okcupid_data and store the result in okcupid_standard_deviation.

Folder Icon

Sign up to start coding

Already have an account?