Created
June 18, 2022 23:33
-
-
Save angeloped/2ecb2f109b92670e2ee2b1a616364909 to your computer and use it in GitHub Desktop.
Python implementation of standard deviation.
This file contains hidden or 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 math | |
# https://en.wikipedia.org/wiki/Unbiased_estimation_of_standard_deviation | |
def std_deviation(items, mean): | |
sum_ = sum([(i-mean)**2 for i in items]) | |
N = len(items) # the size of the population | |
return math.sqrt(sum_ / (N-1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment