Dec-14-2020, 08:56 AM
(This post was last modified: Dec-14-2020, 08:56 AM by Gribouillis.
Edit Reason: improvement
)
I would try the following
from itertools import groupby def report(): data = Load() report = [] for date, irec in groupby(data, key=lambda r: RecToDate(r)): irec = list(irec) counts = [0] * 10 for rec in irec: for j in range(10): counts[j] += RecRan(rec, j) report.append(str(rec)) report.append(Summary(len(irec), counts)) return ''.join(report)