Speaking with charts — COVID-19 data
By: Lakshmi Ajay
Tags: Covid 19, Eda, Charts, Exploratory Data Analysis, Data Visualization

Speaking with charts — COVID-19 data

It has been almost a year since the onset of the pandemic. During this time, I am sure that each one of us would have gone through a multitude of changes, both personally & professionally. As we enter the new year (2021), let us hope that things change for the better.

For data enthusiasts, more time gives more data. Now that we have one year’s covid-19 data, it will be interesting to analyze how the pandemic has been behaving across different countries. As the saying goes, a picture is worth a thousand words’, let us start looking at the data through some visualization charts.

We will be using the seaborn & matplotlib in Python to create the plots. Code snippets are added below as a reference. Please refer to the git path provided at the end to get access to the complete code.

COVID-19 Word Data

The data provided by the Johns Hopkins University is used in this case study. Details are provided at the end. For this case study, the data was downloaded on 2nd Jan 2021.

Data Preprocessing

The input COVID data files contain the no. of cases in a country for each day starting from 22nd Jan 2020. The files are split as confirmed cases, recovered cases, and death cases.

Sample raw data looks like below

Table by the author. Raw data — confirmed cases

Table by the author. Raw data — confirmed cases

The below code snippet is to read any of these raw data files and do the preprocessing. Following is done

Read the raw data file Keep only the required rows & columns Create simplified dataframes from this data - ordered by country and ordered by date.

3 dataframes are created after running the code on the input file

Sample output: confirmed cases ordered by country (Table by Author)

Sample output: confirmed cases ordered by date (Table by Author)

Sample output: raw data with the total count added (Table by Author)

The above dataframes are samples for the confirmed cases datafile. Similar dataframes are created with the recovered & death data files. The individual dataframes are then merged to get the data for Confirmed, Recovered & Death in a single dataframe.

Once the simplified dataframes are created, we are ready to start exploring the data by plotting some data visualization charts.

Data Visualization

Which is the safest continent?

Image by Author

Europe has the most number of confirmed cases with 28.5% of the total cases reported globally

Australia looks to be the safest place currently with 0.1% of the total reported cases

How quickly do the cases spread across countries?

Here the top10 countries are identified based on the total no. of reported cases. The day the first case was reported for each of these countries is considered as day 1.

The rate at which the cases have grown in each of these countries are compared.

Image by Author

As seen in the graph, the growth of cases has been steepest in the USA followed by India. For countries like Germany, UK, Spain, the rate at which the cases have grown looks to be under better control. But this could also be due to the higher population in countries like USA & India.

Monthly cases reported in Top 10 Countries

Next, we will compare the growth of cases in the top 10 countries month on month.

Image by Author

Here we plot the heatmap using the log normalization on the no. of cases. This is due to the high number of cases being reported in the top couple of countries that prevents us from analyzing the progression in other countries. Using the log-scale makes the chart more readable.

As can be seen from the heatmap, the rate of growth is high in the US followed by India and Brazil.

How has the week been?

We can analyze the data for the last week by comparing the no. of confirmed, recovered and death cases reported each day.

Image by Author

Northern America or Latin America? Where are more cases being reported?

The data is available at the sub-region level. Analyzing this data gives an idea of how the cases are distributed across different regions.

Image by Author

Cases reported over the last year

The data from 3 different input files are merged and ordered by date. This can be used to get an overview of the cases, both on daily basis and with the cumulative count.

Image by Author

Image by Author

Some of the fluctuations seen in the spikes are due to the data corrections that happen (Eg: 14th Dec 2020)

The daily cases show some rise & fall in the reported counts. It will be interesting to check if there is any seasonality based on the day of the week. This could also depend on how each country reports the no. of cases (daily basis or beginning of a week or end of a week).

Conclusion

Using the visualization charts it is possible to derive several insights into the data. In this article, we covered some of the basic visualizations. A lot more analysis and insights can be derived using this data.

Data Source & Code

The data is updated regularly and the latest dataset can be downloaded from the below link.

World: https://data.humdata.org/dataset/novel-coronavirus-2019-ncov-cases

time_series_covid19_confirmed_global_iso3_regions.csv

time_series_covid19_deaths_global_iso3_regions.csv

time_series_covid19_recovered_global_iso3_regions.csv

Feel free to download the latest dataset as of today and start exploring.

The code to convert the raw data and generate the above charts is available here: https://github.com/Lakshmi-1212/Covid19_EDA

Disclaimer

The scope of this article is limited to reading the raw data and creating some basic visualization charts from it. This is only for educational purposes and not intended to make any conclusions/predictions on the situation.