在这里,我有一个包含时间和值的数据集。所以在这里,我想每60分钟逐行对值进行求和。
date x
8/6/2018 6:15 0
8/6/2018 6:20 2.89295
8/6/2018 6:25 2.89295
8/6/2018 6:30 2.89295
8/6/2018 6:35 2.89295
8/6/2018 6:40 2.89295
8/6/2018 6:45 2.89295
8/6/2018 6:50 2.89295
8/6/2018 6:55 2.89295
8/6/2018 7:00 2.89295
8/6/2018 7:05 2.89295
8/6/2018 7:10 2.89295
8/6/2018 7:15 2.89295
8/6/2018 7:20 2.89295
8/6/2018 7:25 2.89295
8/6/2018 7:30 2.89295
8/6/2018 7:35 2.89295
8/6/2018 7:40 2.89295
8/6/2018 7:45 3.155946
8/6/2018 7:50 3.155946
8/6/2018 7:55 3.155946
8/6/2018 8:00 3.155946
8/6/2018 8:05 3.155946
8/6/2018 8:10 3.155946
8/6/2018 8:15 3.155946
预期输出为:
在这里,我想将每个值和每五分钟的值相加,直到60分钟60分钟。
表示:
date x new_x
8/6/2018 6:15 0 0
8/6/2018 6:20 2.89295 2.89295
8/6/2018 6:25 2.89295 2.89295 + 2.89295 = 5.7859
8/6/2018 6:30 2.89295 2.89295 + 2.89295 + 2.89295 = 8.67885
8/6/2018 6:35 2.89295 2.89295 + 2.89295 + 2.89295 + 2.89295 = 11.5718
8/6/2018 6:40 2.89295
8/6/2018 6:45 2.89295 like wise till to one hour
8/6/2018 6:50 2.89295
8/6/2018 6:55 2.89295
8/6/2018 7:00 2.89295
8/6/2018 7:05 2.89295
8/6/2018 7:10 2.89295
8/6/2018 7:15 2.89295 2.89295 + 2.89295 + 2.89295 + 2.89295+........= 34.7154
8/6/2018 7:20 2.89295 2.89295 (after one hour then again another hour,so
then again value will be 2.89295)
it will depend on the value at that time)
我不知道如何用增加的值来求和。谁能帮助我解决这个问题?