i got a day by day time-series data scratch from mysql, and i want to turn it into weekly time-series data. How could i make it?
For example here's a dataset of a product which has keys Timestamp & Price, containing 14 days of dates and corresponding prices.
Product: {'Timestamp': [datetime.date(2019, 4, 15), datetime.date(2019, 4, 16), datetime.date(2019, 4, 17), datetime.date(2019, 4, 18), datetime.date(2019, 4, 19), datetime.date(2019, 4, 20), datetime.date(2019, 4, 21), datetime.date(2019, 4, 22), datetime.date(2019, 4, 23), datetime.date(2019, 4, 24), datetime.date(2019, 4, 25), datetime.date(2019, 4, 26), datetime.date(2019, 4, 27), datetime.date(2019, 4, 28)]
, 'Price': ['3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988', '3988']}
Now, instead of simply having corresponding dates and prices, I want to have my weekly average data begin on Saturday and end on Friday (here I use the examples of Friday, 4/19, and Friday, 4/26, to represent the weekly averages, using data from the 6 days prior to each of these dates; note that these dates do not merely represent a single day's price) so the outcome should be like this:
Product: {'Timestamp': [ datetime.date(2019, 4, 19), datetime.date(2019, 4, 26)]
, 'Price': ['3988', '3988']}