This commit is contained in:
Kovid Goyal 2009-01-03 00:18:13 -08:00
parent b32c97ea04
commit cabb094390

View File

@ -102,6 +102,8 @@ class Stats:
def get_deviation(self, amounts): def get_deviation(self, amounts):
l = float(len(amounts)) l = float(len(amounts))
if l == 0:
return 0
mean = sum(amounts)/l mean = sum(amounts)/l
return sqrt( sum([i**2 for i in amounts])/l - mean**2 ) return sqrt( sum([i**2 for i in amounts])/l - mean**2 )