A.append([(float(a) + float(b) + float(c))/3,
(float(d) + float(e) + float(f))/3,
(float(g) + float(h) + float(i))/3,
(float(j) + float(k) + float(l))/3,
(float(m) + float(n) + float(o))/3,
(float(p) + float(q) + float(r))/3,
(float(s) + float(t) + float(u))/3])
def mean(A):
positives = [b for b in A if b >= 0]
E.append((len(positives)) / (len(A))*100)
if positives:
return sum(positives) / len(positives)
else:
return 0
C = map(mean, zip(*A))
print C
#3 sigma check
def sigma(A):
positives = [b for b in A if b >= 0]
if positives:
F.append((positives - C) / len(A))
print F
I am looking to find the standard deviation of the out put of the first chunk of code. It results in lists of seven numbers ie: [[-9999.0, -9999.0, -9999.0, -9999.0, -9999.0, -9999.0, -9999.0], [-9999.0, -9999.0, -9999.0, -9999.0, -9999.0, -9999.0, -9999.0], [0.040896, 0.018690, 0.0056206, -9999.0, 0.038722, 0.018323, -9999.0], [0.03944364, -9999.0, 0.037885, 0.014316, -9999.0]]
The second chunk of code finds the mean of the columns(['0.040170', '0.018057', '0.004782', '0.000000', '0.037378', '0.014778', '0.000000']
)
I began writing the third chunk of code to find standard deviation but F prints out blank. Also I do not think I am writing the function properly to subtract each positive number by the average, any help would be appreciacted