COVID-19/All-cause deaths/Japan

Weekly all-cause deaths in Japan, based on exdeaths-japan.org data, Observed.csv:

Script plotJapan.py:

import sys, csv, datetime

fileName = sys.argv[1] # e.g. "Observed.csv"
data = {}
for line in csv.reader(open(fileName)):
  if "prefecture_id" not in line[0]:
    dateStr = line[3]
    if "-" in dateStr:
      date =  datetime.datetime.strptime(dateStr, "%d-%b-%y") # e.g. 10-Jan-10
    else:
      date =  datetime.datetime.strptime(dateStr, "%d%b%Y") # e.g. 10jan2010
    deaths = int(line[5])
    if not date in data:
      data[date] = 0
    data[date] += deaths

data = data.items()
data.sort(key=lambda x: x[0])

datesOut = ", ".join([k.strftime("%Y-%m-%d") for k, v in data])
deathsOut = ", ".join([str(v) for k, v in data])
sys.stdout.write("|x =" + datesOut + "\n")
sys.stdout.write("|y =" + deathsOut + "\n")

Script oneliner to update the chart:

  • plotJapan.py Observed.csv

External links: