I m trying to average an array based on criteria in another array.
//array with a number of dates including hourly data
double[] dates;
//array with values, same length as dates and corresponding data points
double[] vals;
This is what I would like to do:
double[] dailyavgs = vals.GroupBy((v, i) => DateTime.FromOADate(dates[i]).Date()).Average().ToArray();
but this fails. Could you please point me in the right direction?