Visualizing Covid 19 in Different Countries

Prepared by Mahsa Sadi on 2020 - 06 - 25

In this notebook, we visualize CoVID 19 outbreak in different countries.

Note: The analyzed data sets are downloaded from Kaggle and they do not reflect the real situation.

In [1]:
import pandas
import matplotlib
import seaborn
%matplotlib inline
from matplotlib import pyplot
In [2]:
data_set = pandas.read_csv ('covid_19_india.csv')
data_set_italy = pandas.read_csv ('covid_19_italy.csv')



Visualizing Covid 19 in India



In [3]:
data_set.shape
Out[3]:
(3387, 9)
In [4]:
data_set.info ()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3387 entries, 0 to 3386
Data columns (total 9 columns):
Sno                         3387 non-null int64
Date                        3387 non-null object
Time                        3387 non-null object
State/UnionTerritory        3387 non-null object
ConfirmedIndianNational     3387 non-null object
ConfirmedForeignNational    3387 non-null object
Cured                       3387 non-null int64
Deaths                      3387 non-null int64
Confirmed                   3387 non-null int64
dtypes: int64(4), object(5)
memory usage: 238.2+ KB
In [5]:
data_set.describe ()
Out[5]:
Sno Cured Deaths Confirmed
count 3387.000000 3387.000000 3387.000000 3387.000000
mean 1694.000000 1493.671391 96.738412 3192.308533
std 977.887008 5289.069888 423.320151 10802.658122
min 1.000000 0.000000 0.000000 0.000000
25% 847.500000 1.000000 0.000000 15.500000
50% 1694.000000 35.000000 1.000000 163.000000
75% 2540.500000 597.500000 24.000000 1870.500000
max 3387.000000 69631.000000 6531.000000 139010.000000
In [6]:
data_set.tail (5)
Out[6]:
Sno Date Time State/UnionTerritory ConfirmedIndianNational ConfirmedForeignNational Cured Deaths Confirmed
3382 3383 24/06/20 8:00 AM Tripura - - 807 1 1259
3383 3384 24/06/20 8:00 AM Uttarakhand - - 1602 30 2535
3384 3385 24/06/20 8:00 AM Uttar Pradesh - - 12116 588 18893
3385 3386 24/06/20 8:00 AM West Bengal - - 9218 580 14728
3386 3387 24/06/20 8:00 AM Cases being reassigned to states - - 0 0 8141
In [7]:
data_set ['Deaths'].sum ()
Out[7]:
327653
In [8]:
data_set ['Cured'].sum ()
Out[8]:
5059065
In [9]:
fig_dims = (100, 20)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot = seaborn.barplot ( x = 'State/UnionTerritory', y = 'Deaths', ax = ax, data = data_set)
plot.axes.set_title("Deaths in States",fontsize=50)
plot.set_xlabel("Covid 19 - Deaths - India - States",fontsize=100)
plot.set_ylabel("Count",fontsize=50)
plot.tick_params(labelsize= 50)
ax.tick_params (axis = 'x', labelrotation = 90)
In [10]:
fig_dims = (100, 20)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot = seaborn.barplot ( x = 'State/UnionTerritory', y = 'Cured', ax = ax, data = data_set)
plot.axes.set_title("Recoverd in States in States",fontsize=50)
plot.set_xlabel("Covid 19 - Recovered - India - States",fontsize=100)
plot.set_ylabel("Count",fontsize=50)
plot.tick_params(labelsize= 50)
ax.tick_params (axis = 'x', labelrotation = 90)
In [11]:
months = []
for i in range (0, len (data_set ['Date'])):
    temp = data_set ['Date'][i]
    st = temp.split ('/')
    months.append (st [1][1])
In [12]:
df = pandas.DataFrame(data = months, columns = ['Month'])
augmented_data_set = pandas.concat ( [data_set, df], axis = 1)
augmented_data_set.head (5)
Out[12]:
Sno Date Time State/UnionTerritory ConfirmedIndianNational ConfirmedForeignNational Cured Deaths Confirmed Month
0 1 30/01/20 6:00 PM Kerala 1 0 0 0 1 1
1 2 31/01/20 6:00 PM Kerala 1 0 0 0 1 1
2 3 01/02/20 6:00 PM Kerala 2 0 0 0 2 2
3 4 02/02/20 6:00 PM Kerala 3 0 0 0 3 2
4 5 03/02/20 6:00 PM Kerala 3 0 0 0 3 2
In [13]:
augmented_data_set.describe ()
Out[13]:
Sno Cured Deaths Confirmed
count 3387.000000 3387.000000 3387.000000 3387.000000
mean 1694.000000 1493.671391 96.738412 3192.308533
std 977.887008 5289.069888 423.320151 10802.658122
min 1.000000 0.000000 0.000000 0.000000
25% 847.500000 1.000000 0.000000 15.500000
50% 1694.000000 35.000000 1.000000 163.000000
75% 2540.500000 597.500000 24.000000 1870.500000
max 3387.000000 69631.000000 6531.000000 139010.000000
In [14]:
fig_dims = (10, 5)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot  = seaborn.barplot ( x = 'Month', y = 'Confirmed', data = augmented_data_set)
plot.axes.set_title("Confirmed Cases per Month in India",fontsize=20)
Out[14]:
Text(0.5, 1.0, 'Confirmed Cases per Month in India')
In [15]:
fig_dims = (10, 5)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot  = seaborn.barplot ( x = 'Month', y = 'Deaths', data = augmented_data_set)
plot.axes.set_title("Deaths per Month in India",fontsize=20)
Out[15]:
Text(0.5, 1.0, 'Deaths per Month in India')
In [16]:
fig_dims = (10, 5)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot = seaborn.barplot ( x = 'Month', y = 'Cured', data = augmented_data_set)
plot.axes.set_title("Recovered Cases per Month in India",fontsize=20)
Out[16]:
Text(0.5, 1.0, 'Recovered Cases per Month in India')



Visualizing Covid 19 in Italy



In [17]:
data_set_italy.head (5)
Out[17]:
SNo Date Country RegionCode RegionName Latitude Longitude HospitalizedPatients IntensiveCarePatients TotalHospitalizedPatients HomeConfinement CurrentPositiveCases NewPositiveCases Recovered Deaths TotalPositiveCases TestsPerformed
0 0 2020-02-24T18:00:00 ITA 13 Abruzzo 42.351222 13.398438 0 0 0 0 0 0 0 0 0 NaN
1 1 2020-02-24T18:00:00 ITA 17 Basilicata 40.639471 15.805148 0 0 0 0 0 0 0 0 0 NaN
2 2 2020-02-24T18:00:00 ITA 21 P.A. Bolzano 46.499335 11.356624 0 0 0 0 0 0 0 0 0 NaN
3 3 2020-02-24T18:00:00 ITA 18 Calabria 38.905976 16.594402 0 0 0 0 0 0 0 0 0 NaN
4 4 2020-02-24T18:00:00 ITA 15 Campania 40.839566 14.250850 0 0 0 0 0 0 0 0 0 NaN
In [18]:
data_set_italy.shape
Out[18]:
(2499, 17)
In [19]:
fig_dims = (100, 20)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot = seaborn.barplot ( x = 'RegionName', y = 'Deaths', ax = ax, data = data_set_italy)
plot.set_xlabel("Covid 19 - Deaths - Italy - Regions",fontsize=100)
plot.set_ylabel("Count",fontsize=50)
plot.tick_params(labelsize= 50)
ax.tick_params (axis = 'x', labelrotation = 90)
In [20]:
fig_dims = (100, 20)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot = seaborn.barplot ( x = 'RegionName', y = 'Recovered', ax = ax, data = data_set_italy)
plot.axes.set_title("Recovered in Regions",fontsize=50)
plot.set_xlabel("Covid 19 - Recovered - Italy - Regions",fontsize=100)
plot.set_ylabel("Count",fontsize=50)
plot.tick_params(labelsize= 50)
ax.tick_params (axis = 'x', labelrotation = 90)
In [21]:
months = []
for i in range (0, len (data_set_italy ['Date'])):
    temp = data_set_italy ['Date'][i]
    months.append (temp.split ('-')[1][1])
In [22]:
df = pandas.DataFrame(data = months, columns = ['Month'])
augmented_data_set_italy = pandas.concat ( [data_set_italy, df], axis = 1)
augmented_data_set_italy.head (5)
Out[22]:
SNo Date Country RegionCode RegionName Latitude Longitude HospitalizedPatients IntensiveCarePatients TotalHospitalizedPatients HomeConfinement CurrentPositiveCases NewPositiveCases Recovered Deaths TotalPositiveCases TestsPerformed Month
0 0 2020-02-24T18:00:00 ITA 13 Abruzzo 42.351222 13.398438 0 0 0 0 0 0 0 0 0 NaN 2
1 1 2020-02-24T18:00:00 ITA 17 Basilicata 40.639471 15.805148 0 0 0 0 0 0 0 0 0 NaN 2
2 2 2020-02-24T18:00:00 ITA 21 P.A. Bolzano 46.499335 11.356624 0 0 0 0 0 0 0 0 0 NaN 2
3 3 2020-02-24T18:00:00 ITA 18 Calabria 38.905976 16.594402 0 0 0 0 0 0 0 0 0 NaN 2
4 4 2020-02-24T18:00:00 ITA 15 Campania 40.839566 14.250850 0 0 0 0 0 0 0 0 0 NaN 2
In [23]:
fig_dims = (10, 5)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot  = seaborn.barplot ( x = 'Month', y = 'TotalPositiveCases', data = augmented_data_set_italy)
plot.axes.set_title("Total Positive Cases per Month in Italy",fontsize=20)
Out[23]:
Text(0.5, 1.0, 'Total Positive Cases per Month in Italy')
In [24]:
fig_dims = (10, 5)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot  = seaborn.barplot ( x = 'Month', y = 'Deaths', data = augmented_data_set_italy)
plot.axes.set_title("Deaths per Month in Italy",fontsize = 20)
Out[24]:
Text(0.5, 1.0, 'Deaths per Month in Italy')
In [25]:
fig_dims = (10, 5)
fig, ax = pyplot.subplots(figsize=fig_dims)
plot  = seaborn.barplot ( x = 'Month', y = 'Recovered', data = augmented_data_set_italy)
plot.axes.set_title("Recovered Cases per Month in Italy",fontsize = 20)
Out[25]:
Text(0.5, 1.0, 'Recovered Cases per Month in Italy')
In [ ]: