We have a set of data repetitions for individual days - the first attribute is a timestamp, and the rest are values.
A few of them:
ts a b c
2010-08-06 08:00, 1.2, 3.4, 5.6
2010-08-06 08:05, 1.2, 3.4, 5.6
2010-08-06 08:10, 1.2, 3.4, 5.6
2010-08-06 08:15, 2.2, 3.3, 5.6
2010-08-06 08:20, 1.2, 3.4, 5.6
We would like to create an array of average values of each of the values (as if you put all the data of the day on top of each other and average all the values that line up). The timestamp times are the same, so we can do this by creating a result with timestamps, and the rest of the columns are 0, then we’ll do something like:
for day in day_data:
result.a += day.a
result.b += day.b
result.c += day.c
result.a /= len(day_data)
result.b /= len(day_data)
result.c /= len(day_data)
It seems that the best way would be to convert every day to a 2d array using only numbers (discarding timestamps) and then averaging them over all elements in one operation, but we cannot find a way to do this - it is always a 1d array of objects.
Does anyone know how to do this?