Skip to content

Instantly share code, notes, and snippets.

@markwatson
Created May 3, 2012 20:37
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 markwatson/2589070 to your computer and use it in GitHub Desktop.
Save markwatson/2589070 to your computer and use it in GitHub Desktop.
Random stats functions
def mean(x): return sum(x) / len(x)
def std_dev(x, mx=None):
if mx is None:
mx = mean(x)
return math.sqrt(sum((i - mx)**2 for i in x)/len(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment