1๐
โ
I wasnโt able to solve this via ORM, but it was trivial to pad the data out in regular Python code.
def time_series_pad_zeros(time_series):
result = []
for i in range(0,24):
found = False
for data in time_series:
if data['hour'].hour == i:
found = True
result.append({ "hour": i, "event_count": data['event_count'] })
if not found:
result.append({ "hour": i, "event_count": 0 })
return result
๐คJack Slingerland
Source:stackexchange.com