From epidemic to pandemic

In December 2019, COVID-19 coronavirus was first identified in the Wuhan region of China. By March 11, 2020, the World Health Organization (WHO) categorized the COVID-19 outbreak as a pandemic. A lot has happened in the months in between with major outbreaks in Iran, South Korea, and Italy.

We know that COVID-19 spreads through respiratory droplets, such as through coughing, sneezing, or speaking. But, how quickly did the virus spread across the globe? And, can we see any effect from country-wide policies, like shutdowns and quarantines?

Fortunately, organizations around the world have been collecting data so that governments can monitor and learn from this pandemic. Notably, the Johns Hopkins University Center for Systems Science and Engineering created a publicly available data repository to consolidate this data from sources like the WHO, the Centers for Disease Control and Prevention (CDC), and the Ministry of Health from multiple countries.

In this notebook, you will visualize COVID-19 data from the first several weeks of the outbreak to see at what point this virus became a global pandemic.

Please note that information and data regarding COVID-19 is frequently being updated. The data used in this project was pulled on 27-10-2020, and should not be considered to be the most up to date data available.

In [1]:
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt

%matplotlib inline
matplotlib.style.use('fivethirtyeight')
rng = np.random.RandomState(201910)
In [2]:
import requests
import io

url="https://github.com/RamiKrispin/coronavirus/raw/master/csv/coronavirus.csv"
s=requests.get(url).content.decode('utf8')
In [3]:
df = pd.read_csv(io.StringIO(s))
df.set_index(pd.DatetimeIndex(df['date']), inplace=True)
df.drop(['date'], axis=1)
df.head(3)
Out[3]:
date province country lat long type cases
date
2020-01-22 2020-01-22 NaN Afghanistan 33.93911 67.709953 confirmed 0
2020-01-23 2020-01-23 NaN Afghanistan 33.93911 67.709953 confirmed 0
2020-01-24 2020-01-24 NaN Afghanistan 33.93911 67.709953 confirmed 0

Confirmed cases throughout the world

The table above shows the cumulative confirmed cases of COVID-19 worldwide by date. Just reading numbers in a data frame makes it hard to get a sense of the scale and growth of the outbreak. Let's draw a line plot to visualize the confirmed cases worldwide

In [4]:
wdf = df.resample('W')
In [5]:
wdf['cases'].sum().plot(figsize = (14, 6))
plt.title('Worldwide confirmed cases')
plt.ylabel('Confirmed cases')
plt.show()
2020-10-27T14:32:56.485826 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [6]:
wdf['cases'].mean().plot(figsize = (14, 6), kind='bar', x='date', y='cases')
plt.title('Worldwide daily mean')
plt.ylabel('Confirmed cases')
plt.show()
2020-10-27T14:32:57.053975 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [7]:
c_c_wdf = df[['cases','country']]
In [8]:
c_c_wdf['cases'].resample('W').plot(figsize = (14, 6))
plt.title('Worldwide confirmed cases')
plt.ylabel('Confirmed cases')
plt.show()
2020-10-27T14:32:58.483620 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [9]:
rdf = c_c_wdf.groupby(['date', 'country'])['cases'].aggregate('first').unstack()
In [10]:
rdf = rdf.resample('W')
In [11]:
fig= plt.figure(figsize=(14,6))
rdf['Russia'].mean().plot(kind='line', color='red')
rdf['Germany'].mean().plot(kind='line', color='black')
rdf['Ukraine'].mean().plot(kind='line', color='blue')
plt.xlabel('Date')
plt.ylabel('Confirmed cases')
plt.title('European countries')
plt.legend()
plt.show()
2020-10-27T14:32:59.184029 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [12]:
fig= plt.figure(figsize=(14,6))
rdf['China'].mean().plot(kind='line', color='red')
plt.xlabel('Date')
plt.ylabel('Confirmed cases')
plt.title('Chinese statistic, all clear')
plt.show()
2020-10-27T14:32:59.795882 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/

We will get some usefull country statistics from World Bank API

In [13]:
import wbdata
wbdata.get_topic()
Out[13]:
  id  value
----  -------------------------------
   1  Agriculture & Rural Development
   2  Aid Effectiveness
   3  Economy & Growth
   4  Education
   5  Energy & Mining
   6  Environment
   7  Financial Sector
   8  Health
   9  Infrastructure
  10  Social Protection & Labor
  11  Poverty
  12  Private Sector
  13  Public Sector
  14  Science & Technology
  15  Social Development
  16  Urban Development
  17  Gender
  18  Millenium development goals
  19  Climate Change
  20  External Debt
  21  Trade
In [14]:
wbdata.get_indicator(topic=8)
Out[14]:
  Suicide mortality rate (per 100,000 population)
SH.STA.TRAF.P5        Mortality caused by road traffic injury (per 100,000 people)
SH.STA.WASH.P5        Mortality rate attributed to unsafe water, unsafe sanitation and lack of hygiene (per 100,000 population)
SH.STA.WAST.FE.ZS     Prevalence of wasting, weight for height, female (% of children under 5)
SH.STA.WAST.MA.ZS     Prevalence of wasting, weight for height, male (% of children under 5)
SH.STA.WAST.Q1.ZS     Malnourished children (wasting, -2SD) (% of children under 5): Q1 (lowest)
SH.STA.WAST.Q2.ZS     Malnourished children (wasting, -2SD) (% of children under 5): Q2
SH.STA.WAST.Q3.ZS     Malnourished children (wasting, -2SD) (% of children under 5): Q3
SH.STA.WAST.Q4.ZS     Malnourished children (wasting, -2SD) (% of children under 5): Q4
SH.STA.WAST.Q5.ZS     Malnourished children (wasting, -2SD) (% of children under 5): Q5 (highest)
SH.STA.WAST.ZS        Prevalence of wasting, weight for height (% of children under 5)
SH.STA.WST3.Q1.ZS     Malnourished children (wasting, -3SD) (% of children under 5): Q1 (lowest)
SH.STA.WST3.Q2.ZS     Malnourished children (wasting, -3SD) (% of children under 5): Q2
SH.STA.WST3.Q3.ZS     Malnourished children (wasting, -3SD) (% of children under 5): Q3
SH.STA.WST3.Q4.ZS     Malnourished children (wasting, -3SD) (% of children under 5): Q4
SH.STA.WST3.Q5.ZS     Malnourished children (wasting, -3SD) (% of children under 5): Q5 (highest)
SH.SVR.WAST.FE.ZS     Prevalence of severe wasting, weight for height, female (% of children under 5)
SH.SVR.WAST.MA.ZS     Prevalence of severe wasting, weight for height, male (% of children under 5)
SH.SVR.WAST.ZS        Prevalence of severe wasting, weight for height (% of children under 5)
SH.TBS.CURE.ZS        Tuberculosis treatment success rate (% of new cases)
SH.TBS.DTEC.ZS        Tuberculosis case detection rate (%, all forms)
SH.TBS.INCD           Incidence of tuberculosis (per 100,000 people)
SH.UHC.CONS.TO        Number of people pushed below the 50% median consumption poverty line by out-of-pocket health care expenditure
SH.UHC.CONS.ZS        Proportion of population pushed below the 50% median consumption poverty line by out-of-pocket health care expenditure (%)
SH.UHC.NOP1.CG        Increase in poverty gap at $1.90 ($ 2011 PPP) poverty line due to out-of-pocket health care expenditure (USD)
SH.UHC.NOP1.TO        Number of people pushed below the $1.90 ($ 2011 PPP) poverty line by out-of-pocket health care expenditure
SH.UHC.NOP1.ZG        Increase in poverty gap at $1.90 ($ 2011 PPP) poverty line due to out-of-pocket health care expenditure (% of poverty line)
SH.UHC.NOP1.ZS        Proportion of population pushed below the $1.90 ($ 2011 PPP) poverty line by out-of-pocket health care expenditure (%)
SH.UHC.NOP2.CG        Increase in poverty gap at $3.20 ($ 2011 PPP) poverty line due to out-of-pocket health care expenditure (USD)
SH.UHC.NOP2.TO        Number of people pushed below the $3.20 ($ 2011 PPP) poverty line by out-of-pocket health care expenditure
SH.UHC.NOP2.ZG        Increase in poverty gap at $3.20 ($ 2011 PPP) poverty line due to out-of-pocket health care expenditure (% of poverty line)
SH.UHC.NOP2.ZS        Proportion of population pushed below the $3.20 ($ 2011 PPP) poverty line by out-of-pocket health care expenditure (%)
SH.UHC.OOPC.10.TO     Number of people spending more than 10% of household consumption or income on out-of-pocket health care expenditure
SH.UHC.OOPC.10.ZS     Proportion of population spending more than 10% of household consumption or income on out-of-pocket health care expenditure (%)
SH.UHC.OOPC.25.TO     Number of people spending more than 25% of household consumption or income on out-of-pocket health care expenditure
SH.UHC.OOPC.25.ZS     Proportion of population spending more than 25% of household consumption or income on out-of-pocket health care expenditure (%)
SH.UHC.SRVS.CV.XD     UHC service coverage index
SH.VAC.TTNS.Q1.ZS     Tetanus toxoid vaccination (% of live births): Q1 (lowest)
SH.VAC.TTNS.Q2.ZS     Tetanus toxoid vaccination (% of live births): Q2
SH.VAC.TTNS.Q3.ZS     Tetanus toxoid vaccination (% of live births): Q3
SH.VAC.TTNS.Q4.ZS     Tetanus toxoid vaccination (% of live births): Q4
SH.VAC.TTNS.Q5.ZS     Tetanus toxoid vaccination (% of live births): Q5 (highest)
SH.VAC.TTNS.ZS        Newborns protected against tetanus (%)
SH.VST.OUTP           Outpatient visits per capita
SH.XPD.CHEX.GD.ZS     Current health expenditure (% of GDP)
SH.XPD.CHEX.PC.CD     Current health expenditure per capita (current US$)
SH.XPD.CHEX.PP.CD     Current health expenditure per capita, PPP (current international $)
SH.XPD.EHEX.CH.ZS     External health expenditure (% of current health expenditure)
SH.XPD.EHEX.PC.CD     External health expenditure per capita (current US$)
SH.XPD.EHEX.PP.CD     External health expenditure per capita, PPP (current international $)
SH.XPD.EXTR.ZS        External resources for health (% of total expenditure on health)
SH.XPD.GHED.CH.ZS     Domestic general government health expenditure (% of current health expenditure)
SH.XPD.GHED.GD.ZS     Domestic general government health expenditure (% of GDP)
SH.XPD.GHED.GE.ZS     Domestic general government health expenditure (% of general government expenditure)
SH.XPD.GHED.PC.CD     Domestic general government health expenditure per capita (current US$)
SH.XPD.GHED.PP.CD     Domestic general government health expenditure per capita, PPP (current international $)
SH.XPD.OOPC.CH.ZS     Out-of-pocket expenditure (% of current health expenditure)
SH.XPD.OOPC.PC.CD     Out-of-pocket expenditure per capita (current US$)
SH.XPD.OOPC.PP.CD     Out-of-pocket expenditure per capita, PPP (current international $)
SH.XPD.OOPC.TO.ZS     Out-of-pocket health expenditure (% of total expenditure on health)
SH.XPD.OOPC.ZS        Out-of-pocket health expenditure (% of private expenditure on health)
SH.XPD.PCAP           Health expenditure per capita (current US$)
SH.XPD.PCAP.PP.KD     Health expenditure per capita, PPP (constant 2011 international $)
SH.XPD.PRIV           Health expenditure, private (% of total health expenditure)
SH.XPD.PRIV.ZS        Health expenditure, private (% of GDP)
SH.XPD.PUBL           Health expenditure, public (% of total health expenditure)
SH.XPD.PUBL.GX.ZS     Health expenditure, public (% of government expenditure)
SH.XPD.PUBL.ZS        Health expenditure, public (% of GDP)
SH.XPD.PVTD.CH.ZS     Domestic private health expenditure (% of current health expenditure)
SH.XPD.PVTD.PC.CD     Domestic private health expenditure per capita (current US$)
SH.XPD.PVTD.PP.CD     Domestic private health expenditure per capita, PPP (current international $)
SH.XPD.TOTL.ZS        Health expenditure, total (% of GDP)
SM.EMI.TERT.ZS        Emigration rate of tertiary educated (% of total tertiary educated population)
SM.POP.NETM           Net migration
SM.POP.REFG           Refugee population by country or territory of asylum
SM.POP.REFG.OR        Refugee population by country or territory of origin
SM.POP.TOTL           International migrant stock, total
SM.POP.TOTL.ZS        International migrant stock (% of population)
SN.ITK.DEFC.ZS        Prevalence of undernourishment (% of population)
SN.ITK.DFCT           Depth of the food deficit (kilocalories per person per day)
SN.ITK.DPTH           Depth of hunger (kilocalories per person per day)
SN.ITK.MSFI.ZS        Prevalence of moderate or severe food insecurity in the population (%)
SN.ITK.SALT.ZS        Consumption of iodized salt (% of households)
SN.ITK.SVFI.ZS        Prevalence of severe food insecurity in the population (%)
SN.ITK.VAPP.Q1.ZS     Vitamin A supplements for postpartum women (% of women with a birth): Q1 (lowest)
SN.ITK.VAPP.Q2.ZS     Vitamin A supplements for postpartum women (% of women with a birth): Q2
SN.ITK.VAPP.Q3.ZS     Vitamin A supplements for postpartum women (% of women with a birth): Q3
SN.ITK.VAPP.Q4.ZS     Vitamin A supplements for postpartum women (% of women with a birth): Q4
SN.ITK.VAPP.Q5.ZS     Vitamin A supplements for postpartum women (% of women with a birth): Q5 (highest)
SN.ITK.VITA.Q1.ZS     Vitamin A supplements for children (% of children ages 6-59 months): Q1 (lowest)
SN.ITK.VITA.Q2.ZS     Vitamin A supplements for children (% of children ages 6-59 months): Q2
SN.ITK.VITA.Q3.ZS     Vitamin A supplements for children (% of children ages 6-59 months): Q3
SN.ITK.VITA.Q4.ZS     Vitamin A supplements for children (% of children ages 6-59 months): Q4
SN.ITK.VITA.Q5.ZS     Vitamin A supplements for children (% of children ages 6-59 months): Q5 (highest)
SN.ITK.VITA.ZS        Vitamin A supplementation coverage rate (% of children ages 6-59 months)
SP.ADO.TFRT           Adolescent fertility rate (births per 1,000 women ages 15-19)
SP.DTH.INFR.ZS        Completeness of infant death reporting (% of reported infant deaths to estimated infant deaths)
SP.DTH.REPT.ZS        Completeness of total death reporting (% of reported total deaths to estimated total deaths)
SP.DYN.AMRT.FE        Mortality rate, adult, female (per 1,000 female adults)
SP.DYN.AMRT.MA        Mortality rate, adult, male (per 1,000 male adults)
SP.DYN.CBRT.IN        Birth rate, crude (per 1,000 people)
SP.DYN.CDRT.IN        Death rate, crude (per 1,000 people)
SP.DYN.CEBN.Q1        Mean number of children ever born to women aged 40-49: Q1 (lowest)
SP.DYN.CEBN.Q2        Mean number of children ever born to women aged 40-49: Q2
SP.DYN.CEBN.Q3        Mean number of children ever born to women aged 40-49: Q3
SP.DYN.CEBN.Q4        Mean number of children ever born to women aged 40-49: Q4
SP.DYN.CEBN.Q5        Mean number of children ever born to women aged 40-49: Q5 (highest)
SP.DYN.CONM.Q1.ZS     Current use of contraception (modern method) (% of married women): Q1 (lowest)
SP.DYN.CONM.Q2.ZS     Current use of contraception (modern method) (% of married women): Q2
SP.DYN.CONM.Q3.ZS     Current use of contraception (modern method) (% of married women): Q3
SP.DYN.CONM.Q4.ZS     Current use of contraception (modern method) (% of married women): Q4
SP.DYN.CONM.Q5.ZS     Current use of contraception (modern method) (% of married women): Q5 (highest)
SP.DYN.CONM.ZS        Contraceptive prevalence, modern methods (% of women ages 15-49)
SP.DYN.CONU.Q1.ZS     Current use of contraception (any method) (% of married women): Q1 (lowest)
SP.DYN.CONU.Q2.ZS     Current use of contraception (any method) (% of married women): Q2
SP.DYN.CONU.Q3.ZS     Current use of contraception (any method) (% of married women): Q3
SP.DYN.CONU.Q4.ZS     Current use of contraception (any method) (% of married women): Q4
SP.DYN.CONU.Q5.ZS     Current use of contraception (any method) (% of married women): Q5 (highest)
SP.DYN.CONU.ZS        Contraceptive prevalence, any methods (% of women ages 15-49)
SP.DYN.IMRT.FE.IN     Mortality rate, infant, female (per 1,000 live births)
SP.DYN.IMRT.IN        Mortality rate, infant (per 1,000 live births)
SP.DYN.IMRT.MA.IN     Mortality rate, infant, male (per 1,000 live births)
SP.DYN.IMRT.Q1        Infant mortality rate (per 1,000 live births): Q1 (lowest)
SP.DYN.IMRT.Q2        Infant mortality rate (per 1,000 live births): Q2
SP.DYN.IMRT.Q3        Infant mortality rate (per 1,000 live births): Q3
SP.DYN.IMRT.Q4        Infant mortality rate (per 1,000 live births): Q4
SP.DYN.IMRT.Q5        Infant mortality rate (per 1,000 live births): Q5 (highest)
SP.DYN.LE00.FE.IN     Life expectancy at birth, female (years)
SP.DYN.LE00.IN        Life expectancy at birth, total (years)
SP.DYN.LE00.MA.IN     Life expectancy at birth, male (years)
SP.DYN.TFRT.IN        Fertility rate, total (births per woman)
SP.DYN.TFRT.Q1        Total fertility rate (TFR) (births per woman): Q1 (lowest)
SP.DYN.TFRT.Q2        Total fertility rate (TFR) (births per woman): Q2
SP.DYN.TFRT.Q3        Total fertility rate (TFR) (births per woman): Q3
SP.DYN.TFRT.Q4        Total fertility rate (TFR) (births per woman): Q4
SP.DYN.TFRT.Q5        Total fertility rate (TFR) (births per woman): Q5 (highest)
SP.DYN.TO65.FE.ZS     Survival to age 65, female (% of cohort)
SP.DYN.TO65.MA.ZS     Survival to age 65, male (% of cohort)
SP.DYN.WFRT           Wanted fertility rate (births per woman)
SP.DYN.WFRT.Q1        Total wanted fertility rate (births per woman): Q1 (lowest)
SP.DYN.WFRT.Q2        Total wanted fertility rate (births per woman): Q2
SP.DYN.WFRT.Q3        Total wanted fertility rate (births per woman): Q3
SP.DYN.WFRT.Q4        Total wanted fertility rate (births per woman): Q4
SP.DYN.WFRT.Q5        Total wanted fertility rate (births per woman): Q5 (highest)
SP.HOU.FEMA.ZS        Female headed households (% of households with a female head)
SP.M15.2024.FE.ZS     Women who were first married by age 15 (% of women ages 20-24)
SP.M18.2024.FE.ZS     Women who were first married by age 18 (% of women ages 20-24)
SP.MTR.1519.Q1.ZS     Teenage pregnancy and motherhood (% of women ages 15-19 who have had children or are currently pregnant): Q1 (lowest)
SP.MTR.1519.Q2.ZS     Teenage pregnancy and motherhood (% of women ages 15-19 who have had children or are currently pregnant): Q2
SP.MTR.1519.Q3.ZS     Teenage pregnancy and motherhood (% of women ages 15-19 who have had children or are currently pregnant): Q3
SP.MTR.1519.Q4.ZS     Teenage pregnancy and motherhood (% of women ages 15-19 who have had children or are currently pregnant): Q4
SP.MTR.1519.Q5.ZS     Teenage pregnancy and motherhood (% of women ages 15-19 who have had children or are currently pregnant): Q5 (highest)
SP.MTR.1519.ZS        Teenage mothers (% of women ages 15-19 who have had children or are currently pregnant)
SP.POP.0004.FE.5Y     Population ages 00-04, female (% of female population)
SP.POP.0004.MA.5Y     Population ages 00-04, male (% of male population)
SP.POP.0014.FE.IN     Population ages 0-14, female
SP.POP.0014.FE.ZS     Population ages 0-14, female (% of female population)
SP.POP.0014.MA.IN     Population ages 0-14, male
SP.POP.0014.MA.ZS     Population ages 0-14, male (% of male population)
SP.POP.0014.TO        Population ages 0-14, total
SP.POP.0014.TO.ZS     Population ages 0-14 (% of total population)
SP.POP.0509.FE.5Y     Population ages 05-09, female (% of female population)
SP.POP.0509.MA.5Y     Population ages 05-09, male (% of male population)
SP.POP.1014.FE.5Y     Population ages 10-14, female (% of female population)
SP.POP.1014.MA.5Y     Population ages 10-14, male (% of male population)
SP.POP.1519.FE.5Y     Population ages 15-19, female (% of female population)
SP.POP.1519.MA.5Y     Population ages 15-19, male (% of male population)
SP.POP.1564.FE.IN     Population ages 15-64, female
SP.POP.1564.FE.ZS     Population ages 15-64, female (% of female population)
SP.POP.1564.MA.IN     Population ages 15-64, male
SP.POP.1564.MA.ZS     Population ages 15-64, male (% of male population)
SP.POP.1564.TO        Population ages 15-64, total
SP.POP.1564.TO.ZS     Population ages 15-64 (% of total population)
SP.POP.2024.FE.5Y     Population ages 20-24, female (% of female population)
SP.POP.2024.MA.5Y     Population ages 20-24, male (% of male population)
SP.POP.2529.FE.5Y     Population ages 25-29, female (% of female population)
SP.POP.2529.MA.5Y     Population ages 25-29, male (% of male population)
SP.POP.3034.FE.5Y     Population ages 30-34, female (% of female population)
SP.POP.3034.MA.5Y     Population ages 30-34, male (% of male population)
SP.POP.3539.FE.5Y     Population ages 35-39, female (% of female population)
SP.POP.3539.MA.5Y     Population ages 35-39, male (% of male population)
SP.POP.4044.FE.5Y     Population ages 40-44, female (% of female population)
SP.POP.4044.MA.5Y     Population ages 40-44, male (% of male population)
SP.POP.4549.FE.5Y     Population ages 45-49, female (% of female population)
SP.POP.4549.MA.5Y     Population ages 45-49, male (% of male population)
SP.POP.5054.FE.5Y     Population ages 50-54, female (% of female population)
SP.POP.5054.MA.5Y     Population ages 50-54, male (% of male population)
SP.POP.5559.FE.5Y     Population ages 55-59, female (% of female population)
SP.POP.5559.MA.5Y     Population ages 55-59, male (% of male population)
SP.POP.6064.FE.5Y     Population ages 60-64, female (% of female population)
SP.POP.6064.MA.5Y     Population ages 60-64, male (% of male population)
SP.POP.6569.FE.5Y     Population ages 65-69, female (% of female population)
SP.POP.6569.MA.5Y     Population ages 65-69, male (% of male population)
SP.POP.65UP.FE.IN     Population ages 65 and above, female
SP.POP.65UP.FE.ZS     Population ages 65 and above, female (% of female population)
SP.POP.65UP.MA.IN     Population ages 65 and above, male
SP.POP.65UP.MA.ZS     Population ages 65 and above, male (% of male population)
SP.POP.65UP.TO        Population ages 65 and above, total
SP.POP.65UP.TO.ZS     Population ages 65 and above (% of total population)
SP.POP.7074.FE.5Y     Population ages 70-74, female (% of female population)
SP.POP.7074.MA.5Y     Population ages 70-74, male (% of male population)
SP.POP.7579.FE.5Y     Population ages 75-79, female (% of female population)
SP.POP.7579.MA.5Y     Population ages 75-79, male (% of male population)
SP.POP.80UP.FE        Population ages 80 and above, female
SP.POP.80UP.FE.5Y     Population ages 80 and above, female (% of female population)
SP.POP.80UP.MA.5Y     Population ages 80 and above, male (% of male population)
SP.POP.BRTH.MF        Sex ratio at birth (male births per female births)
SP.POP.DPND           Age dependency ratio (% of working-age population)
SP.POP.DPND.OL        Age dependency ratio, old (% of working-age population)
SP.POP.DPND.YG        Age dependency ratio, young (% of working-age population)
SP.POP.GROW           Population growth (annual %)
SP.POP.TOTL           Population, total
SP.POP.TOTL.FE.IN     Population, female
SP.POP.TOTL.FE.ZS     Population, female (% of total population)
SP.POP.TOTL.MA.IN     Population, male
SP.POP.TOTL.MA.ZS     Population, male (% of total population)
SP.REG.BRTH.FE.ZS     Completeness of birth registration, female (%)
SP.REG.BRTH.MA.ZS     Completeness of birth registration, male (%)
SP.REG.BRTH.RU.ZS     Completeness of birth registration, rural (%)
SP.REG.BRTH.UR.ZS     Completeness of birth registration, urban (%)
SP.REG.BRTH.ZS        Completeness of birth registration (%)
SP.REG.DTHS.ZS        Completeness of death registration with cause-of-death information (%)
SP.UWT.LMTG.Q1.ZS     Unmet need for family planning (for limiting) (% of married women): Q1 (lowest)
SP.UWT.LMTG.Q2.ZS     Unmet need for family planning (for limiting) (% of married women): Q2
SP.UWT.LMTG.Q3.ZS     Unmet need for family planning (for limiting) (% of married women): Q3
SP.UWT.LMTG.Q4.ZS     Unmet need for family planning (for limiting) (% of married women): Q4
SP.UWT.LMTG.Q5.ZS     Unmet need for family planning (for limiting) (% of married women): Q5 (highest)
SP.UWT.SPCG.Q1.ZS     Unmet need for family planning (for spacing) (% of married women): Q1 (lowest)
SP.UWT.SPCG.Q2.ZS     Unmet need for family planning (for spacing) (% of married women): Q2
SP.UWT.SPCG.Q3.ZS     Unmet need for family planning (for spacing) (% of married women): Q3
SP.UWT.SPCG.Q4.ZS     Unmet need for family planning (for spacing) (% of married women): Q4
SP.UWT.SPCG.Q5.ZS     Unmet need for family planning (for spacing) (% of married women): Q5 (highest)
SP.UWT.TFRT           Unmet need for contraception (% of married women ages 15-49)
SP.UWT.TFRT.Q1.ZS     Unmet need for family planning (total) (% of married women): Q1 (lowest)
SP.UWT.TFRT.Q2.ZS     Unmet need for family planning (total) (% of married women): Q2
SP.UWT.TFRT.Q3.ZS     Unmet need for family planning (total) (% of married women): Q3
SP.UWT.TFRT.Q4.ZS     Unmet need for family planning (total) (% of married women): Q4
SP.UWT.TFRT.Q5.ZS     Unmet need for family planning (total) (% of married women): Q5 (highest)
In [15]:
indicators={"SP.URB.TOTL":"popUrban",
            "EN.URB.LCTY.UR.ZS":"popLgstCity",
            "EN.POP.EL5M.UR.ZS":"urbBelow5m",
            "EN.POP.SLUM.UR.ZS":"popSlums",
            "SP.POP.TOTL":"popTotal",
            "EN.POP.DNST":"popDens",
            "SH.XPD.CHEX.GD.ZS":"healthExp"
            }
In [16]:
wbdata.get_country()
Out[16]:
id    name
----  --------------------------------------------------------------------------------
ABW   Aruba
AFG   Afghanistan
AFR   Africa
AGO   Angola
ALB   Albania
AND   Andorra
ANR   Andean Region
ARB   Arab World
ARE   United Arab Emirates
ARG   Argentina
ARM   Armenia
ASM   American Samoa
ATG   Antigua and Barbuda
AUS   Australia
AUT   Austria
AZE   Azerbaijan
BDI   Burundi
BEA   East Asia & Pacific (IBRD-only countries)
BEC   Europe & Central Asia (IBRD-only countries)
BEL   Belgium
BEN   Benin
BFA   Burkina Faso
BGD   Bangladesh
BGR   Bulgaria
BHI   IBRD countries classified as high income
BHR   Bahrain
BHS   Bahamas, The
BIH   Bosnia and Herzegovina
BLA   Latin America & the Caribbean (IBRD-only countries)
BLR   Belarus
BLZ   Belize
BMN   Middle East & North Africa (IBRD-only countries)
BMU   Bermuda
BOL   Bolivia
BRA   Brazil
BRB   Barbados
BRN   Brunei Darussalam
BSS   Sub-Saharan Africa (IBRD-only countries)
BTN   Bhutan
BWA   Botswana
CAA   Sub-Saharan Africa (IFC classification)
CAF   Central African Republic
CAN   Canada
CEA   East Asia and the Pacific (IFC classification)
CEB   Central Europe and the Baltics
CEU   Europe and Central Asia (IFC classification)
CHE   Switzerland
CHI   Channel Islands
CHL   Chile
CHN   China
CIV   Cote d'Ivoire
CLA   Latin America and the Caribbean (IFC classification)
CME   Middle East and North Africa (IFC classification)
CMR   Cameroon
COD   Congo, Dem. Rep.
COG   Congo, Rep.
COL   Colombia
COM   Comoros
CPV   Cabo Verde
CRI   Costa Rica
CSA   South Asia (IFC classification)
CSS   Caribbean small states
CUB   Cuba
CUW   Curacao
CYM   Cayman Islands
CYP   Cyprus
CZE   Czech Republic
DEA   East Asia & Pacific (IDA-eligible countries)
DEC   Europe & Central Asia (IDA-eligible countries)
DEU   Germany
DFS   IDA countries classified as Fragile Situations
DJI   Djibouti
DLA   Latin America & the Caribbean (IDA-eligible countries)
DMA   Dominica
DMN   Middle East & North Africa (IDA-eligible countries)
DNF   IDA countries not classified as Fragile Situations
DNK   Denmark
DNS   IDA countries in Sub-Saharan Africa not classified as fragile situations
DOM   Dominican Republic
DSA   South Asia (IDA-eligible countries)
DSF   IDA countries in Sub-Saharan Africa classified as fragile situations
DSS   Sub-Saharan Africa (IDA-eligible countries)
DXS   IDA total, excluding Sub-Saharan Africa
DZA   Algeria
EAP   East Asia & Pacific (excluding high income)
EAR   Early-demographic dividend
EAS   East Asia & Pacific
ECA   Europe & Central Asia (excluding high income)
ECS   Europe & Central Asia
ECU   Ecuador
EGY   Egypt, Arab Rep.
EMU   Euro area
ERI   Eritrea
ESP   Spain
EST   Estonia
ETH   Ethiopia
EUU   European Union
FCS   Fragile and conflict affected situations
FIN   Finland
FJI   Fiji
FRA   France
FRO   Faroe Islands
FSM   Micronesia, Fed. Sts.
FXS   IDA countries classified as fragile situations, excluding Sub-Saharan Africa
GAB   Gabon
GBR   United Kingdom
GEO   Georgia
GHA   Ghana
GIB   Gibraltar
GIN   Guinea
GMB   Gambia, The
GNB   Guinea-Bissau
GNQ   Equatorial Guinea
GRC   Greece
GRD   Grenada
GRL   Greenland
GTM   Guatemala
GUM   Guam
GUY   Guyana
HIC   High income
HKG   Hong Kong SAR, China
HND   Honduras
HPC   Heavily indebted poor countries (HIPC)
HRV   Croatia
HTI   Haiti
HUN   Hungary
IBB   IBRD, including blend
IBD   IBRD only
IBT   IDA & IBRD total
IDA   IDA total
IDB   IDA blend
IDN   Indonesia
IDX   IDA only
IMN   Isle of Man
IND   India
INX   Not classified
IRL   Ireland
IRN   Iran, Islamic Rep.
IRQ   Iraq
ISL   Iceland
ISR   Israel
ITA   Italy
JAM   Jamaica
JOR   Jordan
JPN   Japan
KAZ   Kazakhstan
KEN   Kenya
KGZ   Kyrgyz Republic
KHM   Cambodia
KIR   Kiribati
KNA   St. Kitts and Nevis
KOR   Korea, Rep.
KWT   Kuwait
LAC   Latin America & Caribbean (excluding high income)
LAO   Lao PDR
LBN   Lebanon
LBR   Liberia
LBY   Libya
LCA   St. Lucia
LCN   Latin America & Caribbean
LCR   Latin America and the Caribbean
LDC   Least developed countries: UN classification
LIC   Low income
LIE   Liechtenstein
LKA   Sri Lanka
LMC   Lower middle income
LMY   Low & middle income
LSO   Lesotho
LTE   Late-demographic dividend
LTU   Lithuania
LUX   Luxembourg
LVA   Latvia
MAC   Macao SAR, China
MAF   St. Martin (French part)
MAR   Morocco
MCA   Central America
MCO   Monaco
MDA   Moldova
MDE   Middle East (developing only)
MDG   Madagascar
MDV   Maldives
MEA   Middle East & North Africa
MEX   Mexico
MHL   Marshall Islands
MIC   Middle income
MKD   North Macedonia
MLI   Mali
MLT   Malta
MMR   Myanmar
MNA   Middle East & North Africa (excluding high income)
MNE   Montenegro
MNG   Mongolia
MNP   Northern Mariana Islands
MOZ   Mozambique
MRT   Mauritania
MUS   Mauritius
MWI   Malawi
MYS   Malaysia
NAC   North America
NAF   North Africa
NAM   Namibia
NCL   New Caledonia
NER   Niger
NGA   Nigeria
NIC   Nicaragua
NLD   Netherlands
NLS   Non-resource rich Sub-Saharan Africa countries, of which landlocked
NOR   Norway
NPL   Nepal
NRS   Non-resource rich Sub-Saharan Africa countries
NRU   Nauru
NXS   IDA countries not classified as fragile situations, excluding Sub-Saharan Africa
NZL   New Zealand
OED   OECD members
OMN   Oman
OSS   Other small states
PAK   Pakistan
PAN   Panama
PER   Peru
PHL   Philippines
PLW   Palau
PNG   Papua New Guinea
POL   Poland
PRE   Pre-demographic dividend
PRI   Puerto Rico
PRK   Korea, Dem. People’s Rep.
PRT   Portugal
PRY   Paraguay
PSE   West Bank and Gaza
PSS   Pacific island small states
PST   Post-demographic dividend
PYF   French Polynesia
QAT   Qatar
ROU   Romania
RRS   Resource rich Sub-Saharan Africa countries
RSO   Resource rich Sub-Saharan Africa countries, of which oil exporters
RUS   Russian Federation
RWA   Rwanda
SAS   South Asia
SAU   Saudi Arabia
SCE   Southern Cone
SDN   Sudan
SEN   Senegal
SGP   Singapore
SLB   Solomon Islands
SLE   Sierra Leone
SLV   El Salvador
SMR   San Marino
SOM   Somalia
SRB   Serbia
SSA   Sub-Saharan Africa (excluding high income)
SSD   South Sudan
SSF   Sub-Saharan Africa
SST   Small states
STP   Sao Tome and Principe
SUR   Suriname
SVK   Slovak Republic
SVN   Slovenia
SWE   Sweden
SWZ   Eswatini
SXM   Sint Maarten (Dutch part)
SXZ   Sub-Saharan Africa excluding South Africa
SYC   Seychelles
SYR   Syrian Arab Republic
TCA   Turks and Caicos Islands
TCD   Chad
TEA   East Asia & Pacific (IDA & IBRD countries)
TEC   Europe & Central Asia (IDA & IBRD countries)
TGO   Togo
THA   Thailand
TJK   Tajikistan
TKM   Turkmenistan
TLA   Latin America & the Caribbean (IDA & IBRD countries)
TLS   Timor-Leste
TMN   Middle East & North Africa (IDA & IBRD countries)
TON   Tonga
TSA   South Asia (IDA & IBRD)
TSS   Sub-Saharan Africa (IDA & IBRD countries)
TTO   Trinidad and Tobago
TUN   Tunisia
TUR   Turkey
TUV   Tuvalu
TWN   Taiwan, China
TZA   Tanzania
UGA   Uganda
UKR   Ukraine
UMC   Upper middle income
URY   Uruguay
USA   United States
UZB   Uzbekistan
VCT   St. Vincent and the Grenadines
VEN   Venezuela, RB
VGB   British Virgin Islands
VIR   Virgin Islands (U.S.)
VNM   Vietnam
VUT   Vanuatu
WLD   World
WSM   Samoa
XKX   Kosovo
XZN   Sub-Saharan Africa excluding South Africa and Nigeria
YEM   Yemen, Rep.
ZAF   South Africa
ZMB   Zambia
ZWE   Zimbabwe
In [17]:
countries = ['RUS', 'DEU', 'UKR', 'FRA']
wddf=wbdata.get_dataframe(indicators,country=countries)
In [18]:
wddf
Out[18]:
popUrban popLgstCity urbBelow5m popSlums popTotal popDens healthExp
country date
Germany 2020 NaN NaN NaN NaN NaN NaN NaN
2019 64324835.0 5.529423 NaN NaN 83132799.0 NaN NaN
2018 64096118.0 5.541869 NaN 0.01 82905782.0 237.307597 NaN
2017 63861626.0 5.542036 NaN NaN 82657002.0 236.595495 11.246835
2016 63592936.0 5.545256 NaN 0.01 82348669.0 235.712929 11.130659
... ... ... ... ... ... ... ... ...
Ukraine 1964 22308888.0 6.008955 NaN NaN 44796964.0 77.322800 NaN
1963 21721791.0 5.955798 NaN NaN 44288608.0 76.445340 NaN
1962 21129702.0 5.909113 NaN NaN 43752230.0 75.519513 NaN
1961 20541161.0 5.866387 NaN NaN 43206345.0 74.577276 NaN
1960 19963644.0 5.825820 NaN NaN 42664652.0 NaN NaN

244 rows × 7 columns

In [19]:
dateindex = wddf.index.get_level_values('date')
dateindex = pd.DatetimeIndex(dateindex)
popTotal2019 = wddf.loc[dateindex.year == 2019]['popTotal']
popTotal2019
Out[19]:
country             date
Germany             2019     83132799.0
France              2019     67059887.0
Russian Federation  2019    144373535.0
Ukraine             2019     44385155.0
Name: popTotal, dtype: float64
In [20]:
fig= plt.figure(figsize=(14,6))
rdf['Russia'].mean().multiply(other=1/popTotal2019[2]).plot(kind='line', color='red')
rdf['Germany'].mean().multiply(other=1/popTotal2019[0]).plot(kind='line', color='black')
rdf['Ukraine'].mean().multiply(other=1/popTotal2019[3]).plot(kind='line', color='blue')
plt.xlabel('Date')
plt.ylabel('Confirmed cases')
plt.title('Confirmed cases per Total population')
plt.show()
2020-10-27T14:33:00.691731 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/

We will update this notebook from time to time to get more clear understanding of situation from provided statistic point of view.


Comments

comments powered by Disqus