Let's visualize the number of people infected with coronavirus with matplotlib

** Warning! This article does not contain more information than "I tried to graph the data". ** **

Source of data

This is a csv summary of the number of infected people in each country, compiled by the Center for Systems Science and Engineering of John Hopkins University. https://github.com/CSSEGISandData/COVID-19

Visualize with matplotlib

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

#Read CSV data with pandas.
data = pd.read_csv('COVID-19/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv')
confirmed = [0] * (len(data.columns) - 4)
days_from_22_Jan_20 = np.arange(0, len(data.columns) - 4, 1)

#Process the data
for i in range(0, len(data), 1):
	if (data.iloc[i][1] == "Japan"):
		print(str(data.iloc[i][0]) + " of " + data.iloc[i][1])
		for day in range(4, len(data.columns), 1):
			confirmed[day - 4] += data.iloc[i][day]
print(days_from_22_Jan_20)
print(confirmed)

#Pour into matplotlib
fig = plt.figure(1, figsize=(1.6180 * 4, 4))
axes = fig.add_subplot(111)
axes.set_xlabel("days from 22, Jan, 2020")
axes.set_ylabel("Comfirmed (JP)")
plt.grid()
axes.plot(days_from_22_Jan_20, confirmed, "o-", color="orange")
plt.show()

What comes out

This is (as of March 10, 2020). 絵

so?

I feel that the horizontal axis 25-40 is linear and extends, but it seems that I got on a slightly different line from around 41-. I'm still not sure if this is a straight line with a large slope or a logistic one. I wonder why it went up in the first place. ((I wrote that it doesn't contain more information than "I tried to graph the data", but I started thinking by looking at the data. I don't like it!))

Comments that may come

--Like data from other countries → Please change Japan on the 11th line to US or Mainland China. ――What does the graph look like? → Please clean it yourself. ――Set the date and time on the horizontal axis → If you give me about 3000 yen with a Bank of Japan note, I will do it!

Recommended Posts

Let's visualize the number of people infected with coronavirus with matplotlib
Predict the number of people infected with COVID-19 with Prophet
Visualize the behavior of the sorting algorithm with matplotlib
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud
I tried to predict the number of people infected with coronavirus in Japan by the method of the latest paper in China
I tried to predict the number of people infected with coronavirus in consideration of the effect of refraining from going out
Align the size of the colorbar with matplotlib
Count the number of characters with echo
I tried to predict the number of domestically infected people of the new corona with a mathematical model
Let's calculate the transition of the basic reproduction number of the new coronavirus by prefecture
Increase the font size of the graph with matplotlib
Calculate the total number of combinations with python
The basis of graph theory with matplotlib animation
Create a BOT that displays the number of infected people in the new corona
Add information to the bottom of the figure with Matplotlib
Visualize the range of interpolation and extrapolation with python
Visualize the characteristic vocabulary of a document with D3.js
Let's test the medical collapse hypothesis of the new coronavirus
Manage the package version number of requirements.txt with pip-tools
Visualize the appreciation status of art works with OpenCV
Adjust the ratio of multiple figures with the matplotlib gridspec
Visualize the number of complaints from life insurance companies
Let's examine the convergence time from the global trend of the effective reproduction number of the new coronavirus
Let's put out a ranking of the number of effective reproductions of the new coronavirus by prefecture
A server that returns the number of people in front of the camera with bottle.py and OpenCV
10. Counting the number of lines
Let's visualize the trading volume of TSE stocks --jpxlab sample
Let's execute the command on time with the bot of discord
Get the number of digits
Let's touch the API of Netatmo Weather Station with Python. #Python #Netatmo
Reformat the timeline of the pandas time series plot with matplotlib
Let's visualize GraphConvModel of DeepChem
[Homology] Count the number of holes in data with Python
Calculate the number of changes
Change the style of matplotlib
Visualize the orbit of Hayabusa2
Let's use the distributed expression of words quickly with fastText!
Visualize the flow rate of tweets with Diamond + Graphite + Grafana
I wrote the basic operation of matplotlib with Jupyter Lab
[Python] I tried to visualize the prize money of "ONE PIECE" over 100 million characters with matplotlib.
Get the number of PVs of Qiita articles you posted with API
[Python] Let's reduce the number of elements in the result in set operations
Visualize the frequency of word occurrences in sentences with Word Cloud. [Python]
Let's summarize the degree of coupling between modules with Python code
[Word2vec] Let's visualize the result of natural language processing of company reviews
Plot the spread of the new coronavirus
Get the number of views of Qiita
Calculation of the number of Klamer correlations
Analyzing the age-specific severity of coronavirus
Get the number of Youtube subscribers
Unravel the mystery of matplotlib specgram
About the size of matplotlib points
Visualize the response status of the census 2020
Let's decide the winner of bingo
I want to solve the problem of memory leak when outputting a large number of images with Matplotlib
Create a bot that posts the number of people positive for the new coronavirus in Tokyo to Slack
[Python] Yuriko Koike Calculate the number of votes you need exactly [matplotlib]
Did the number of store closures increase due to the impact of the new coronavirus?
Get the number of searches with a regular expression. SeleniumBasic VBA Python
Adjust the bin width crisply and neatly with the histogram of matplotlib and seaborn
Generate a list packed with the number of days in the current month.