Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
one-liner: Counter solution in Clear category for Aggregate and Count by tom-tom
from collections import Counter
def aggregate_and_count(items: list) -> dict:
return sum((Counter({k: n}) for k, n in items), Counter())
July 17, 2021