我正在使用数据框,其格式如下:
Instrument | Date | Time | MilliSecond | Volume
--------------------------------------------------------------
ABC | 5/20/2012 | 10:30:20 | 205 | 123
--------------------------------------------------------------
ABC | 5/20/2012 | 10:30:20 | 205 | 456
--------------------------------------------------------------
ABC | 5/20/2012 | 10:30:20 | 205 | 789
--------------------------------------------------------------
ABC | 5/20/2012 | 10:31:12 | 329 | 150
--------------------------------------------------------------
ABC | 5/20/2012 | 10:31:12 | 329 | 430
--------------------------------------------------------------
DEF | 5/20/2012 | 10:32:40 | 430 | 58
--------------------------------------------------------------
DEF | 5/20/2012 | 10:32:40 | 430 | 164
--------------------------------------------------------------
GHI | 5/20/2012 | 10:33:27 | 531 | 762
--------------------------------------------------------------
我想要做的是根据“工具”,“日期”,“时间”和“毫秒”列对“音量”列中的值求和,以便我能够获得如下所示的数据框:
Instrument | Date | Time | MilliSecond | Volume
--------------------------------------------------------------
ABC | 5/20/2012 | 10:30:20 | 205 | 1368
--------------------------------------------------------------
ABC | 5/20/2012 | 10:31:12 | 329 | 580
--------------------------------------------------------------
DEF | 5/20/2012 | 10:32:40 | 430 | 222
--------------------------------------------------------------
GHI | 5/20/2012 | 10:33:27 | 531 | 762
--------------------------------------------------------------
(简单地说,如果Instrument,Date,Time和MilliSecond列对于多行是相同的,我想总结Volume然后将它们全部放在一行中)
有谁知道我可以这样做的好方法?之前有一个类似的问题,但它有点不同,我无法将它真正应用到我的数据框中(特别是因为我必须根据几列来总结Volume)。提前谢谢。