GodsDevProject's picture
Update core/analysis.py
1551218 verified
raw
history blame contribute delete
301 Bytes
from typing import Dict, List
def build_timeline(docs: List[dict]) -> Dict[str, int]:
timeline: Dict[str, int] = {}
for d in docs:
year = d.get("date", "")[:4]
if not year.isdigit():
continue
timeline[year] = timeline.get(year, 0) + 1
return timeline