Data Max/Min average using LBT SDK

The easiest way to do this is by converting the Hourly data collection to a MonthlyPerHour data collection. The following should do the trick for any hourly data collection data_hourly, even if it is discontinuous or does not have all months of the year:

data_mph = data_hourly.average_monthly_per_hour()
data_by_month= [[] for _ in range(12)]
for v, dt in zip(data_mph.values, data_mph.datetimes):
    data_by_month[dt[0] - 1].append(v)
max_vals = [max(vals) for vals in data_by_month if len(vals) != 0]
1 Like