Skip to content

Instantly share code, notes, and snippets.

@angeloped
Created June 18, 2022 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angeloped/2ecb2f109b92670e2ee2b1a616364909 to your computer and use it in GitHub Desktop.
Save angeloped/2ecb2f109b92670e2ee2b1a616364909 to your computer and use it in GitHub Desktop.
Python implementation of standard deviation.
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