Skip to content

Instantly share code, notes, and snippets.

@dcramer
Created February 13, 2013 05:45
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 dcramer/4942531 to your computer and use it in GitHub Desktop.
Save dcramer/4942531 to your computer and use it in GitHub Desktop.
def meanstdv(x):
n, mean, std = len(x), 0, 0
for a in x:
mean = mean + a
mean = mean / float(n)
for a in x:
std = std + (a - mean) ** 2
std = math.sqrt(std / float(n - 1))
return mean, std
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment