Fix vaccination numbers by filling voids, move data to subfolder

This commit is contained in:
fordprefect
2020-12-21 11:07:34 +01:00
parent 22c65b1b68
commit e2bcf7329f
2 changed files with 11 additions and 3 deletions

View File

@@ -19,7 +19,8 @@ corr = {"Chile": 10000,
"Peru": 10000,
"Bolivia": 3000,
"Yemen": 220,
"Turkey": 100000,
"Turkey": 40000,
"Spain": 30000,
}
def plot(data, countries, pop, **kwargs):
@@ -45,8 +46,15 @@ def plot(data, countries, pop, **kwargs):
ax1.plot(time, new_cases, label="raw new cases", color="grey", linestyle="-")
ax1.plot(time[3:-3], np.convolve(new_cases, np.ones((7,))/7, mode="valid"), label="new cases 7day mean", color="orange", linestyle="-", linewidth=2)
if not np.isnan(total_vaccinations[-1]):
# plot vaccinations
if not np.isnan(total_vaccinations).all() :
print(f"{loc} has vaccines, adding to plot")
# fix data: not all countries report daily
for n in range(1, len(total_vaccinations)):
if np.isnan(total_vaccinations[n]) and not np.isnan(total_vaccinations[n-1]):
total_vaccinations[n] = total_vaccinations[n-1]
ax2.plot(time, np.array(total_vaccinations), label=f"Total vaccinations", marker="", linestyle="-.", color="crimson")
# fix lower bound of plot

View File

@@ -70,7 +70,7 @@ def get_data():
dataurl = "https://covid.ourworldindata.org/data/owid-covid-data.csv"
date = datetime.date.today()
datafile = f"{date}-full-data.csv"
datafile = f"data/{date}-full-data.csv"
if not os.path.isfile(datafile):