Data Visualization & Analysis

Emmanuel Olaosebikan
4 min readJun 13, 2021

All Weekly Excess Deaths.

Since the data set has undergone data wrangling (clean up) for data visualization and analysis which is the next step we’re to move on to Visualization and Analysis, click here to check the Wrangling aspect for this data set. For Data Visualization, we’d use a python library called ‘Matplotlib’ which is used for plotting charts and also animations.

import matplotlib.pyplot as plt

The next thing i’d want to do is to visualize the number deaths against the number of weeks for the year 2020. With this, we would be able to know the level of increment or decrement in the rate at which people die due to covid 19.

no_weeks_2020 = weekly_deaths_df.loc[weekly_deaths_df.year == 2020].week.unique()for x in weekly_deaths_df.index:
if weekly_deaths_df.loc[x, 'covid_deaths'] < 0:
weekly_deaths_df.loc[x, 'covid_deaths']=0

covid_deaths_in_2020 = []
for x in no_weeks_2020:
covid_deaths_in_2020.append(weekly_deaths_df.loc[(weekly_deaths_df.week == x) & (weekly_deaths_df.year ==2020)].week.sum())
plt.figure(dpi=200)
plt.title('Bar Chart of number of Covid Deaths in 2020')
plt.xlabel('Weeks')
plt.ylabel('Number of Deaths')
plt.bar(no_weeks_2020, covid_deaths_in_2020)
plt.show()
Bar Chart of number of Covid Deaths in 2020

From the chart above, we can observe that the rate at which people die due to Covid 19 increased as the week increases and towards the end of the year, if the chart was observed well, the rate reduced. Now the next thing is to also check for the year included in the data set which is 2021.

no_weeks_2021 =weekly_deaths_df.loc[weekly_deaths_df.year == 2021].week.unique()for x in weekly_deaths_df.index:
if weekly_deaths_df.loc[x, 'covid_deaths'] < 0:
weekly_deaths_df.loc[x, 'covid_deaths']=0

covid_deaths_in_2021 = []
for x in no_weeks_2021:
covid_deaths_in_2021.append(weekly_deaths_df.loc[(weekly_deaths_df.week == x) & (weekly_deaths_df.year ==2021)].week.sum())
plt.figure(dpi=200)
plt.title('Bar Chart of number of Covid Deaths in 2021')
plt.xlabel('Weeks')
plt.ylabel('Number of Deaths')
plt.bar(no_weeks_2021, covid_deaths_in_2021)
plt.show()
Bar Chart of number of Covid Deaths in 2020

At this point, we’d observe as well that it continued increasing at the beginning of the year but at a point, the rate at which the people die due to Covid began to drop drastically which happen to be due to the invention of the cure for the virus.

The thing to visualize is to also check the ratio of death due to covid and not.

non_covid_deaths = weekly_deaths_df.loc[(weekly_deaths_df.year == 2020)].non_covid_deaths.sum()
covid_deaths = weekly_deaths_df.loc[(weekly_deaths_df.year == 2020)].covid_deaths.sum()
labels = ['Non Covid Deaths', 'Covid Deaths']
colors = ['#ff9999','#66b3ff']
explode = [0.1 , 0.1]
plt.figure(dpi=100)
plt.title(' The ratio of non covid deaths to covid deaths in 2020 ')
plt.tight_layout()
plt.pie([non_covid_deaths, covid_deaths], colors = colors, labels = labels, autopct='%1.2f %%', shadow = True, explode = explode)
plt.show()
The ratio of non covid deaths in 2020

Then we’d also visualize that for the 2021 as well.

non_covid_deaths = weekly_deaths_df.loc[(weekly_deaths_df.year == 2021)].non_covid_deaths.sum()
covid_deaths = weekly_deaths_df.loc[(weekly_deaths_df.year == 2021)].covid_deaths.sum()
labels = ['Non Covid Deaths', 'Covid Deaths']
colors = ['#99ff99','#ffcc99']
explode = [0.1 , 0.1]
plt.figure(dpi=100)
plt.title(' The ratio of non covid deaths to covid deaths in 2021 ')
plt.tight_layout()
plt.pie([non_covid_deaths, covid_deaths], colors = colors, labels = labels, autopct='%1.2f %%', shadow = True, explode = explode)
plt.show()
The ratio of non covid deaths in 2020

From the charts above, 9.32% of the deaths in the 45 specified countries data sets in 2020 were caused by covid 19 and in 2021, 19.49% deaths so far was caused by covid 19 which seems to be quite more than 2020’s. But we observed that the rate at which people died due to covid 19 this year (2021) reduced, that means there are has been lesser deaths due to other causes of death and not covid 19 compared to last year (2020).

In 2020, a lot of people died not just due to Covid 19 which had a lesser percentage compared to the non covid and these causes were
Ischaemic heart disease
* Stroke
* Chronic obstructive pulmonary disease
* Lower respiratory infections
* Neonatal conditions
* Trachea, bronchus and lung cancers
* Alzheimer’s disease and other forms of dementia
* Diarrhoeal diseases
* Diabetes
* HIV/AIDS
* Tuberculosis
* Road Accidents
* Cholera
* Maleria

A lot of people died due to these top cases in 2020. In 2021 as well people also died due to these conditions as well but reduced drastically compared to the year 2020 due to the advancement in Medical treatments which were able to revive lives and also Covid 19 vaccines which was also able to reduce the rate at which people died in 2021.

The files for this piece of article for both the Wrangling process and the Visualization process can be gotten here in my Github repository.

Thanks for reading!

--

--

Emmanuel Olaosebikan

A student of Federal University of Agriculture Abeokuta, skilled with Web development, Graphics Design and Python Programming.