I have a time-series data that look like this:
datetime | value
2016-01-01 | 1
2016-01-02 | 14
2016-01-03 | 3
2016-01-04 | 15
2016-01-05 | 5
2016-01-06 | 4
2016-01-07 | 7
2016-01-08 | 15
What I want to obtain is the average per three days (as well as per a week) and keep the last day as the index like this:
datetime | value
2016-01-03 | 6
2016-01-06 | 8
2016-01-08 | 11
You may notice that the remaining 2 records need to be just averaged. Is there an handy way of doing this either in pandas dataframe
or graphlab SFrame
? If someone can share a relevant resource, that would be great!
I appreciate any help!
You can use
agg
by numpy array created by floor division: