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
我正在尋找第一塊代碼的輸出標準偏差。它導致7個號碼的清單,即:[[-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]]
在Python中找到一列數據的標準偏差
代碼的第二塊找到列(['0.040170', '0.018057', '0.004782', '0.000000', '0.037378', '0.014778', '0.000000']
)的
我開始寫代碼的第三塊找到標準差的均值,但˚F打印出空白。另外我不認爲我正確地編寫函數來減少每個正數的平均值,任何幫助都將被賞識
這可能是一個愚蠢的問題,但你可以解釋'* myList'的語法或指向我在該運算符的正確方向嗎?我一直在C++參考文獻 – sedavidw
這實際上是一個非常好的問題。它將列表變成列表元素的序列。檢查[this](http://stackoverflow.com/q/2921847/198633)out – inspectorG4dget
非常有幫助,謝謝! – sedavidw