In C#, I have a List<Tuple<DateTime,Double>> named timeseries. I’m trying to calculate some basic statistics (averages and whatnot) and subsets of dates from timeseries. For example, I want to calculate the average over:
- One Month (ie. Today to 1 month ago)
- Three Months
- Six Months
- One Year
My thought was to use a loop to go through each of the above and remove dates from the timeseries to then reduce the data just Tuple that I’m interested. This seems pretty inefficient though…
Does anyone have any thoughts on how I could do this? Would LINQ do it?
Thanks!
Here is for one month, the same with 3 or 6 months: