Ontario COVID-19

Example with matplotlib

June 06, 2021 · 1 min read

Data Visualization

Start by getting copying the following template to get a chart with labels.

For the data processing part, I’m using the dataset from the Ontario Government for COVID testing:
filename = "https://data.ontario.ca/dataset/f4f86e54-872d-43f8-8a86-3892fd3cb5e6/resource/ed270bb8-340b-41f9-a7c6-e8ef587e6d11/download/covidtesting.csv"

To process the data, I used columns 1, 5, and 6 (Reported Date, Confirmed Positive, Deaths):

# Get dates, case and death counts from CSV file.
dates, casesOnt, deaths = [], [], []
for row in reader:
    current_date = datetime.strptime(row[0], "%Y-%m-%d")

    if row[4] == "":
        caseOnt = 0
        caseOnt = float(row[4])

    if row[6] =="":
        death = 0
        death = float(row[6])

The result is a chart that looks like this: Ontario COVID-19

Check out the repository on Github.