I have a set of data with a list of dates (all Sundays in this case) and associated amounts. Most of these are every week, but some correspond to multiple weeks added together. I would like to average over those items that contain multiple weeks, to have just single weeks.
data = {{"18/03/2018", 323.4}, {"25/03/2018", 339.55}, {"01/04/2018", 201.45}, {"15/04/2018", 733.17}, {"29/04/2018", 691.44}, {"06/05/2018", 383.16}, {"13/05/2018", 386.2}, {"20/05/2018", 218.33}, {"27/05/2018", 382.7}, {"10/06/2018", 735.43}, {"17/06/2018", 232.15}, {"24/06/2018", 430.2}, {"01/07/2018", 298.5}, {"08/07/2018", 338.5}, {"15/07/2018", 264.05}, {"29/07/2018", 625.44}, {"05/08/2018", 353.01}, {"26/08/2018", 274.19}, {"02/09/2018", 368.25}}
data2 = {DateObject[{#[[1]], {"Day", "Month", "Year"}}], #[[2]]} & /@ data
You can see how multiple weeks are combined, resulting in a higher data point:
DateListPlot[data2, Joined -> False]
I know I could do this manually by working out the difference between each pair of data points, but as I'm so unfamiliar with how to use date/time objects I suspect there is a better way. My goal is to work on the weekly averages (to predict the overall trend).
Answers that don't require the data to be regular days each week (i.e. not always a multiple of 7 days between them) would be nice to see too.