https://www.t3.com/news/best-coronavirus-maps-to-update-you-about-the-global-cases-of-covid-19

Mapping and visualizing the spreading of COVID-19

Valentina Alto
Mar 14, 2020 · 4 min read

On 23 January 2020, the central government of China imposed a lockdown in Wuhan and other cities in Hubei province in an effort to quarantine the epicenter of an outbreak of coronavirus disease 2019 (COVID-19).

However, given the current mobility and globalization, it was inevitable for this disease to expand also outside its epicenter, resulting in what the WHO defined as a real pandemic.

Many countries these days are experiencing restrictions comparable to those in Hubei. Yet this is the only weapon (at least so far) we have to fight the further spreading of this disease. And the exceptionality of the situation can be understood even more deeply if we look at the numbers of this crisis.

In this article, I’m going to provide a graphical representation of the evolution of the COVID-19, relying on this real-time updated dataset. For this purpose, I will use the python library Plotly, and I will provide global time-series data as well as country-specific information.

Let’s first download the dataset and do some data cleaning (specifically, I converted the column ‘Date’ to datetime).

import pandas as pd
df = pd.read_csv("covid_19_clean_complete.csv")
df['Date'] = pd.to_datetime(df['Date'])
df.head()

Let’s now examine the spreading of the disease around its epicenter. So let’s first filter our dataset:

m = [df['Country/Region'][i]=='China' for i in range(len(df))]
df_china=df[m]
df_china.head()
df_china=df_china.groupby('Date').sum().reset_index(drop=False).sort_values('Date')

Now let’s plot the result on a map, using ‘Asia’ as scope.

import plotly.express as px
fig = px.scatter_geo(df_china, lat='Lat', lon='Long', color="Province/State",
hover_name="Province/State", size="Confirmed",
animation_frame="Date", size_max=30,
projection="natural earth", scope='asia')
fig.show()

As you can see, the biggest bubble (where the size of the bubble indicates the number of infected) is in Hubei, the province of the epicenter.

We can also inspect which was the pace of the spreading, taking the trace of infected, recovered and deaths.

import plotly.graph_objects as go
import pandas as pd
fig = go.Figure()
fig.add_trace(go.Scatter(
x=df_china['Date'],
y=df_china['Confirmed'],
name="Confirmed",
line_color='deepskyblue',
opacity=0.8))
fig.add_trace(go.Scatter(
x=df_china['Date'],
y=df_china['Deaths'],
name="Deaths",
line_color='tomato',
opacity=0.8))
fig.add_trace(go.Scatter(
x=df_china['Date'],
y=df_china['Recovered'],
name="Recovered",
line_color='forestgreen',
opacity=0.8))
# Use date string to set xaxis range
fig.update_layout(title_text="COVID-19 spreading in China")
fig.show()

The explosion of this virus was exponential. Indeed, virologists attributed to this new virus a basic reproductive number of 2–3. It means that, assuming that everyone is susceptible to contracting the virus, each infectious person transmits the disease, on average, to 2–3 people.

Interestingly, by observing the pace of this spreading across different countries, I noticed a common exponential pattern, which eventually plateau (generally when lockdown policy is enforced by governments). In particular, I examined Italy, Iran and the US, obtaining the following results:

Now let’s see the overall evolution across countries:

import plotly.express as px
fig = px.scatter_geo(df, lat='Lat', lon='Long', color="Country/Region",
hover_name="Province/State", size="Confirmed",
animation_frame="Date", size_max=30,
projection="natural earth")
fig.show()
import plotly.graph_objects as go
import pandas as pd
df = df.groupby('Date').sum().reset_index(drop=False).sort_values('Date')fig = go.Figure()
fig.add_trace(go.Scatter(
x=df['Date'],
y=df['Confirmed'],
name="Confirmed",
line_color='deepskyblue',
opacity=0.8))
fig.add_trace(go.Scatter(
x=df['Date'],
y=df['Deaths'],
name="Deaths",
line_color='tomato',
opacity=0.8))
fig.add_trace(go.Scatter(
x=df['Date'],
y=df['Recovered'],
name="Recovered",
line_color='forestgreen',
opacity=0.8))
# Use date string to set xaxis range
fig.update_layout(title_text="COVID-19 spreading worldwile")
fig.show()

Besides the difference in numbers, the initial behavior looks pretty similar. The main difference is the moment of plateauing: in China, since it started way before, the restrictive measures started producing effects from the middle of February, more or less when other countries started experiencing the first positive cases.

Hopefully, all the measures taken by countries and citizens should lead to the same result as China, yet only numbers and time will tell us.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data…

Sign up for Analytics Vidhya News Bytes

By Analytics Vidhya

Latest news from Analytics Vidhya on our Hackathons and some of our best articles! Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Valentina Alto

Written by

Cloud Specialist at @Microsoft | MSc in Data Science | Machine Learning, Statistics and Running enthusiast

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Valentina Alto

Written by

Cloud Specialist at @Microsoft | MSc in Data Science | Machine Learning, Statistics and Running enthusiast

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store