In this post we are going to check the data about coronavirus with Python into a shell in this web page in different States: Italy, France, Singapore, South Korea etc. Hit run to see them on the right part of the shell below.
Data from different States
import pandas as pd
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
days = []
for n in range(5, 0, -1):
day = datetime.today() - timedelta(n)
days.append(str(day.month) + "/" + str(day.day))
month = str(datetime.today().month)
c = []
def check(what, day, State):
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-{}.csv".format(what)
df = pd.read_csv(url, error_bad_lines=False)
print(what, end=" ")
result = df.loc[df["Country/Region"]==State]["{}/20".format(day)]
print(list(result)[0], end=" - ")
what = "Confirmed", "Recovered", "Deaths"
states = """Italy
France
South Korea
Singapore
Hong Kong
Japan""".splitlines()
for s in states:
print(s)
for d in days:
print("{}".format(d), end=": ")
for w in what:
check(w, d, s)
print()
Just press 'Run'.
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame