The Coronavirus is transmitted from person to person principally by respiratory droplets, causing such symptoms as fever, cough, and shortness of breath after a period believed to range from 2 to 14 days following infection, according to the Centers for Disease Control and Prevention (CDC).
The United States has been at the forefront of the outbreak. We also deem it fit to analyze the COVID 19 data for Nigeria which has fairly growing cases using python programming. The data is a small fraction scrapped from the NCDC website for this practice.
Note: This descriptive analysis demonstrates how to use Data Science ( Python programming) to generate insights from public health data.
Covid 19 in Nigeria as Captured by the Nigeria Centre for Disease Control (NCDC Website as at 29th of August 2020)
Data Used for this Task (Data for 29th of August 2020)
Import libraries for this task
import pandas as pd import numpy as np import matplotlib.pyplot as plt
covid=pd.read_excel('NCDCCovid19.xlsx')
View the dataset
print(covid)
Check for the shape of the data
covid.shape
(37, 5) # The data has 37 rows and 5 columns in total.
Check columns information
covid.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 37 entries, 0 to 36 Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 States Affected 37 non-null object 1 No. of Cases (Lab Confirmed) 37 non-null int64 2 No. of Cases (on admission) 37 non-null int64 3 No. Discharged 37 non-null int64 4 No. of Deaths 36 non-null float64 dtypes: float64(1), int64(3), object(1) memory usage: 1.6+ KB
Check missing values in columns
We have one missing value under the No. of Deaths column (arising from Kogi State)
covid.isna().sum()
States Affected 0 No. of Cases (Lab Confirmed) 0 No. of Cases (on admission) 0 No. Discharged 0 No. of Deaths 1 dtype: int64
Check out for different columns in the dataset
covid_cols=covid.columns
covid_cols
Index([‘States Affected’, ‘No. of Cases (Lab Confirmed)’, ‘No. of Cases (on admission)’, ‘No. Discharged’, ‘No. of Deaths’], dtype=’object’)
Check for list of states
covid[“States Affected”].unique()
array([‘Lagos’, ‘FCT’, ‘Oyo’, ‘Edo’, ‘Plateau’, ‘Rivers’, ‘Kaduna’, ‘Delta’, ‘Kano’, ‘Ogun’, ‘Ondo’, ‘Enugu’, ‘Ebonyi’, ‘Kwara’, ‘Katsina’, ‘Osun’, ‘Abia’, ‘Borno’, ‘Gombe’, ‘Bauchi’, ‘Imo’, ‘Benue’, ‘Nasarawa’, ‘Bayelsa’, ‘Jigawa’, ‘Akwa Ibom’, ‘Ekiti’, ‘Niger’, ‘Adamawa’, ‘Anambra’, ‘Sokoto’, ‘Kebbi’, ‘Taraba’, ‘Cross River’, ‘Zamfara’, ‘Yobe’, ‘Kogi’], dtype=object)
Check the first 10 entries
covid.head(10)
Check the last 10 entries
covid.tail(10)
Do a Descriptive Analysis
Average number of covid 19 deaths across all states in Nigeria is 28
Highest number of deaths recorded in a state is 202 and minimum is 4.
75% of cases result into approx. 30 deaths & 25% of cases result into more than 30 deaths.
covid.describe()
View number of Discharged across different states
covid[[‘States Affected’, ‘No. Discharged’]].head(10)
Accessing rows and Columns
covid.loc[0:5,’No. of Deaths’]
0 202.0 1 50.0 2 37.0 3 100.0 4 29.0 5 57.0 Name: No. of Deaths, dtype: float64
covid.loc[0:7,[‘No. of Deaths’,’States Affected’]]
Check correlations between variables
Number of Discharged is highly correlated with Number of Cases (Lab Confirmed)
corr = covid.corr()
corr
Visualize the correlation result
plt.figure(figsize=(10, 10))
sns.heatmap(corr, annot=True)
Scatter Plot of No. of Cases (Lab Confirmed) and No. of Deaths.
fig, ax = plt.subplots(figsize=(12, 8))
plt.scatter(covid[‘No. of Cases (Lab Confirmed)’], covid[‘No. of Deaths’])
plt.xlabel(‘No. of Cases (Lab Confirmed)’)
plt.ylabel(‘No. of Deaths’)
Number of Deaths raise to over 200 when Number of Lab Confirmed Cases raise to over 18,000.
Scatter Plot of Number of Deaths and Number of Discharged.
fig, ax = plt.subplots(figsize=(12, 8))
plt.scatter(covid[‘No. of Deaths’], covid[‘No. Discharged’])
plt.xlabel(‘No. of Deaths’)
plt.ylabel(‘No. Discharged’)
Number of Discharged raise to over 15,000 as Number of Deaths raise to over 200.