{
 "nbformat": 4,
 "nbformat_minor": 5,
 "metadata": {
  "kernelspec": {
   "name": "python",
   "display_name": "Python (Pyodide)",
   "language": "python"
  },
  "language_info": {
   "name": "python"
  }
 },
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "# Chronology by era\n\nCounts of entries per era, and the share that still needs a source. A count is a count of register entries, not of events in history."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "import csv, io\nfrom pyodide.http import open_url\nrows = list(csv.DictReader(open_url(\"/nx/labs/data/chronology.csv\")))\nlen(rows)"
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "from collections import defaultdict\nera = defaultdict(lambda: [0, 0])\nfor r in rows:\n    era[r['era']][0] += 1\n    era[r['era']][1] += r['status'] == 'needs-citation'\nfor k, (n, todo) in era.items():\n    print(f'{k:28} {n:3} entries, {todo} need a source')"
  }
 ]
}