3
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

新型コロナ(COVID-19)の感染者・死者・検査・陽性率・ワクチン接種数の推移

Last updated at Posted at 2021-05-31

Data on COVID-19 (coronavirus) by Our World in Data で毎日更新されているデータがあるので、次のようにして新型コロナ(COVID-19)の感染者・死者・検査・ワクチン接種数の推移を見ることができます。

import requests
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot') 

url = "https://github.com/owid/covid-19-data/blob/master/public/data/owid-covid-data.csv?raw=true"
df = pd.read_csv(url)
df
iso_code continent location date total_cases new_cases new_cases_smoothed total_deaths new_deaths new_deaths_smoothed total_cases_per_million new_cases_per_million new_cases_smoothed_per_million total_deaths_per_million new_deaths_per_million new_deaths_smoothed_per_million reproduction_rate icu_patients icu_patients_per_million hosp_patients hosp_patients_per_million weekly_icu_admissions weekly_icu_admissions_per_million weekly_hosp_admissions weekly_hosp_admissions_per_million new_tests total_tests total_tests_per_thousand new_tests_per_thousand new_tests_smoothed new_tests_smoothed_per_thousand positive_rate tests_per_case tests_units total_vaccinations people_vaccinated people_fully_vaccinated new_vaccinations new_vaccinations_smoothed total_vaccinations_per_hundred people_vaccinated_per_hundred people_fully_vaccinated_per_hundred new_vaccinations_smoothed_per_million stringency_index population population_density median_age aged_65_older aged_70_older gdp_per_capita extreme_poverty cardiovasc_death_rate diabetes_prevalence female_smokers male_smokers handwashing_facilities hospital_beds_per_thousand life_expectancy human_development_index
0 AFG Asia Afghanistan 2020-02-24 1.0 1.0 NaN NaN NaN NaN 0.026 0.026 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 8.33 38928341.0 54.422 18.6 2.581 1.337 1803.987 NaN 597.029 9.59 NaN NaN 37.746 0.5 64.83 0.511
1 AFG Asia Afghanistan 2020-02-25 1.0 0.0 NaN NaN NaN NaN 0.026 0.000 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 8.33 38928341.0 54.422 18.6 2.581 1.337 1803.987 NaN 597.029 9.59 NaN NaN 37.746 0.5 64.83 0.511
2 AFG Asia Afghanistan 2020-02-26 1.0 0.0 NaN NaN NaN NaN 0.026 0.000 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 8.33 38928341.0 54.422 18.6 2.581 1.337 1803.987 NaN 597.029 9.59 NaN NaN 37.746 0.5 64.83 0.511
3 AFG Asia Afghanistan 2020-02-27 1.0 0.0 NaN NaN NaN NaN 0.026 0.000 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 8.33 38928341.0 54.422 18.6 2.581 1.337 1803.987 NaN 597.029 9.59 NaN NaN 37.746 0.5 64.83 0.511
4 AFG Asia Afghanistan 2020-02-28 1.0 0.0 NaN NaN NaN NaN 0.026 0.000 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 8.33 38928341.0 54.422 18.6 2.581 1.337 1803.987 NaN 597.029 9.59 NaN NaN 37.746 0.5 64.83 0.511
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
92126 ZWE Africa Zimbabwe 2021-05-25 38706.0 10.0 15.857 1587.0 1.0 0.571 2604.198 0.673 1.067 106.776 0.067 0.038 1.32 NaN NaN NaN NaN NaN NaN NaN NaN 1416.0 540768.0 36.384 0.095 1937.0 0.130 0.008 122.2 tests performed 927990.0 639553.0 288437.0 13069.0 13719.0 6.24 4.30 1.94 923.0 NaN 14862927.0 42.729 19.6 2.822 1.882 1899.775 21.4 307.846 1.82 1.6 30.7 36.791 1.7 61.49 0.571
92127 ZWE Africa Zimbabwe 2021-05-26 38819.0 113.0 29.571 1589.0 2.0 0.857 2611.800 7.603 1.990 106.910 0.135 0.058 1.38 NaN NaN NaN NaN NaN NaN NaN NaN 1629.0 542397.0 36.493 0.110 1725.0 0.116 0.017 58.3 tests performed 937040.0 643531.0 293509.0 9050.0 13194.0 6.30 4.33 1.97 888.0 NaN 14862927.0 42.729 19.6 2.822 1.882 1899.775 21.4 307.846 1.82 1.6 30.7 36.791 1.7 61.49 0.571
92128 ZWE Africa Zimbabwe 2021-05-27 38854.0 35.0 31.286 1592.0 3.0 1.000 2614.155 2.355 2.105 107.112 0.202 0.067 1.38 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 953389.0 648121.0 305268.0 16349.0 12285.0 6.41 4.36 2.05 827.0 NaN 14862927.0 42.729 19.6 2.822 1.882 1899.775 21.4 307.846 1.82 1.6 30.7 36.791 1.7 61.49 0.571
92129 ZWE Africa Zimbabwe 2021-05-28 38918.0 64.0 36.286 1592.0 0.0 0.857 2618.461 4.306 2.441 107.112 0.000 0.058 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 976796.0 656630.0 320166.0 23407.0 12695.0 6.57 4.42 2.15 854.0 NaN 14862927.0 42.729 19.6 2.822 1.882 1899.775 21.4 307.846 1.82 1.6 30.7 36.791 1.7 61.49 0.571
92130 ZWE Africa Zimbabwe 2021-05-29 38933.0 15.0 36.286 1594.0 2.0 1.143 2619.471 1.009 2.441 107.247 0.135 0.077 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 14862927.0 42.729 19.6 2.822 1.882 1899.775 21.4 307.846 1.82 1.6 30.7 36.791 1.7 61.49 0.571

92131 rows × 59 columns

import numpy as np
import matplotlib.pyplot as plt

locations = ['Japan']
colname = "new_cases_per_million"
plt.figure(figsize=(16,4))
for location in locations:
    df1 = df[df['location'] == location].fillna(0)
    x = np.array(df1['date'], dtype=np.datetime64)
    y = np.array(df1[colname])
    plt.plot(x, y, label=location)

plt.ylabel(colname)
plt.legend()
plt.tight_layout()
plt.savefig("{}.png".format(colname), format="png", dpi=500)
plt.show()

新型コロナ(COVID_19)の感染者・死者・検査・ワクチン接種数の推移_3_0.png

import numpy as np
import matplotlib.pyplot as plt

locations = ['Japan', 'United States', 'United Kingdom']

colname = "new_cases_per_million"
plt.figure(figsize=(16,4))
for location in locations:
    df1 = df[df['location'] == location].fillna(0)
    x = np.array(df1['date'], dtype=np.datetime64)
    y = np.array(df1[colname])
    plt.plot(x, y, label=location)

plt.ylabel(colname)
plt.legend()
plt.tight_layout()
plt.savefig("{}.png".format(colname), format="png", dpi=500)
plt.show()

新型コロナ(COVID_19)の感染者・死者・検査・ワクチン接種数の推移_4_0.png

課題

  • 日本、米国、英国における「新規感染者数(百万人あたり)」の推移を図示し、比較してください。
  • 日本、米国、英国における「新規死亡者数(百万人あたり)」の推移を図示し、比較してください。
  • スウェーデン、イタリア、シンガポール、韓国、台湾、中国についても同様に「新規感染者数(百万人あたり)」と「新規死亡者数(百万人あたり)」の推移を図示し、比較してください。
3
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?