I tried to tabulate the number of deaths per capita of COVID-19 (new coronavirus) by country

Purpose

Calculate the number of deaths per capita of COVID-19 by country. It is nonsense to compare the number of infected people because the population and the number of tests differ from country to country. Even if I looked it up, it didn't come out easily, or the date was old, so I made it myself.

Data source

The number of infected people, the number of deaths, and the population of 2018 are summarized by country. There was covid-19-cases-worldwide). Since it was the data as of April 4, 2020, I saved it as "data20200404.csv".

Source code

I tried using pandas for the first time. Convenient.

import pandas as pd
import matplotlib.pyplot as plt
import datetime as dt

coutry_for_analysis = [
    'United_States_of_America', 'United_Kingdom', 'France', 'Germany', 'Japan',
    'Italy', 'China', 'South_Korea', 'Spain'
]

data = pd.read_csv('data20200404.csv')
data['dateRep'] = pd.to_datetime(data['dateRep'], format="%d/%m/%Y")

fig = plt.figure(figsize=(12, 8))

plt.rcParams['font.family'] = 'Arial'
plt.rcParams['font.size'] = 18
plt.rcParams['xtick.major.width'] = 2.0
plt.rcParams['ytick.major.width'] = 2.0
ax = fig.add_subplot(111)
ax.set_xlabel('Date')
ax.set_ylabel('Cumulative # of Death per population (%)')
ax.spines['top'].set_linewidth(0)
ax.spines['bottom'].set_linewidth(2.0)
ax.spines['left'].set_linewidth(2.0)
ax.spines['right'].set_linewidth(0)
ax.tick_params(axis='x', rotation=45)
ax.set_xlim([dt.date(2020, 3, 1), dt.date(2020, 4, 5)])

for key, grp in data.groupby('countriesAndTerritories'):
    if key in coutry_for_analysis:
        grp = grp.sort_values('dateRep')
        ax.plot(
            grp['dateRep'],
            100.0 * grp['deaths'].cumsum() / grp['popData2018'],
            label=key,
            linewidth=2.0,
            marker='o',
            markersize=6)

ax.legend(ncol=3, bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, fontsize=18)

plt.savefig('figure.svg', bbox_inches='tight', pad_inches=0.5)

plot

What you think is up to you. figure.png

Recommended Posts

I tried to tabulate the number of deaths per capita of COVID-19 (new coronavirus) by country
I tried to predict the behavior of the new coronavirus with the SEIR model.
I tried to automatically send the literature of the new coronavirus to LINE with Python
I tried to predict the number of people infected with coronavirus in Japan by the method of the latest paper in China
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud
(Now) I analyzed the new coronavirus (COVID-19)
I tried to predict the number of domestically infected people of the new corona with a mathematical model
I tried fitting the exponential function and logistics function to the number of COVID-19 positive patients in Tokyo
Did the number of store closures increase due to the impact of the new coronavirus?
(Python) I tried to analyze 1 million hands ~ I tried to estimate the number of AA ~
I tried to find the optimal path of the dreamland by (quantum) annealing
I tried to verify and analyze the acceleration of Python by Cython
I tried to streamline the standard role of new employees with Python
I tried to verify the result of A / B test by chi-square test
Let's calculate the transition of the basic reproduction number of the new coronavirus by prefecture
I tried to analyze the New Year's card by myself using python
I tried to touch the API of ebay
I tried to correct the keystone of the image
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
I tried to predict the presence or absence of snow by machine learning.
I tried to rescue the data of the laptop by booting it on Ubuntu
I tried to display the infection condition of coronavirus on the heat map of seaborn
I tried to predict the number of people infected with coronavirus in consideration of the effect of refraining from going out
python beginners tried to predict the number of criminals
I tried to visualize the spacha information of VTuber
I tried to erase the negative part of Meros
I tried increasing or decreasing the number by programming
I tried to classify the voices of voice actors
I tried to summarize the string operations of Python
I tried to summarize the new coronavirus infected people in Ichikawa City, Chiba Prefecture
Let's put out a ranking of the number of effective reproductions of the new coronavirus by prefecture
I tried to find the entropy of the image with python
[Horse Racing] I tried to quantify the strength of racehorses
I tried to find the average of the sequence with TensorFlow
Since the stock market crashed due to the influence of the new coronavirus, I tried to visualize the performance of my investment trust with Python.
I tried to get the number of days of the month holidays (Saturdays, Sundays, and holidays) with python
I tried to verify the yin and yang classification of Hololive members by machine learning
[Python] I tried to visualize the follow relationship of Twitter
[Machine learning] I tried to summarize the theory of Adaboost
I tried to predict the infection of new pneumonia using the SIR model: ☓ Wuhan edition ○ Hubei edition
I tried to fight the Local Minimum of Goldstein-Price Function
Quantify the degree of self-restraint required to contain the new coronavirus
I tried to find the trend of the number of ships in Tokyo Bay from satellite images.
I tried to predict the sales of game software with VARISTA by referring to the article of Codexa
I drew a Python graph using public data on the number of patients positive for the new coronavirus (COVID-19) in Tokyo + with a link to the national version of practice data
[Python] The status of each prefecture of the new coronavirus is only published in PDF, but I tried to scrape it without downloading it.
I tried to verify the speaker identification by the Speaker Recognition API of Azure Cognitive Services with Python. # 1
Stock price plummeted with "new corona"? I tried to get the Nikkei Stock Average by web scraping
I tried to verify the speaker identification by the Speaker Recognition API of Azure Cognitive Services with Python. # 2
I tried to summarize the contents of each package saved by Python pip in one line
I tried using PDF data of online medical care based on the spread of the new coronavirus infection
I tried to sort out the objects from the image of the steak set meal-② Overlap number sorting
[Linux] I tried to summarize the command of resource confirmation system
I tried to get the index of the list using the enumerate function
I tried to automate the watering of the planter with Raspberry Pi
I tried to build the SD boot image of LicheePi Nano
I tried to visualize the Beverage Preference Dataset by tensor decomposition.
I tried to summarize the commands used by beginner engineers today
I tried to predict by letting RNN learn the sine wave
I tried to expand the size of the logical volume with LVM