2016-11-13 160 views

回答

1

嘗試使用rolling此:

S = pd.Series(range(1,10)) 
S1 = S.rolling(2).mean().dropna() 

輸出:

1 1.5 
2 2.5 
3 3.5 
4 4.5 
5 5.5 
6 6.5 
7 7.5 
8 8.5 
+0

哇,太酷了!謝謝! – fiendnick

+0

不客氣! – Abdou