Created
October 23, 2019 01:32
-
-
Save albertyumol/88ea806ad551a42562a80bb159db6ce2 to your computer and use it in GitHub Desktop.
Calculate the standard deviation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def standard_deviation(x): | |
x_bar = np.mean(x) | |
N = len(x) | |
deviation_mean = [x_i - x_bar for x_i in x] | |
return np.sqrt(np.dot(deviation_mean, deviation_mean) / N) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment