A courier firm logs every parcel: the depot it left from and how many minutes it took to deliver. The scanners at some depots glitch, so a few times are missing — stored as None.
The manager wants exactly the report that split–summarise–combine gives in pandas:
but it has to run on a machine without pandas.
Task: write depot_report(depots, minutes). The two lists have the same length, and row i of the log is depots[i] with minutes[i]. Return a list of tuples (depot, total, mean, count), one per depot, behaving the way pandas does:
depots, sorted alphabetically by depot name — pandas lists its groups in sorted order.None) are skipped: they add nothing to total, aren't counted in count, and aren't part of the mean.total and mean are floats rounded to 4 decimal places; count is an int.total 0.0, count 0 and mean None — there is nothing to average.