【发布时间】:2015-04-23 11:27:40
【问题描述】:
我很难在以下包含重复索引的数据框中使用 pd.rolling_mean 函数:
amount
20140101 3
20140102 4
20140103 3
20140103 5
20140103 1
20140104 5
20140105 6
20140106 2
…
我需要计算“金额”的3天平均值,例如20140101到20140103的平均值应该是(3+4+3+5+1)/5=3.2,20140104到20140106的平均值应该是(5+6+2)/3=4.3
有人知道怎么做吗?提前谢谢!
【问题讨论】:
标签: python numpy pandas dataframe average-precision