Skip to content

Instantly share code, notes, and snippets.

View ceteri's full-sized avatar

Paco Nathan ceteri

View GitHub Profile
images = []
for file_name in image_files:
images.append(imageio.imread(file_name))
gif_path = "movie.gif"
imageio.mimsave(gif_path, images, fps=2)
anim_path = pathlib.Path("anim/")
anim_path.mkdir(parents=True, exist_ok=True)
fig = plt.figure()
image_files = []
for date in dates:
is_earthday = ihme["date"]==date
cv19 = contiguous_usa.merge(ihme[is_earthday], left_on="state", right_on="location_name")
date_set = set([])
for d in ihme["date"].tolist():
if d >= "2020–03–23" and d <= "2020–04–01":
date_set.add(d)
dates = sorted(list(date_set))
def plot_choropleth (anim_path, date, cv19, cities):
ax = gplt.choropleth(
cv19,
hue="deaths_per_mil",
edgecolor="white",
linewidth=5,
cmap="Reds",
alpha=0.8,
projection=gcrs.AlbersEqualArea(),
figsize=(30, 30)
ax = gplt.choropleth(
cv19,
hue="deaths_per_mil",
edgecolor="white",
linewidth=5,
cmap="Reds",
alpha=0.8,
projection=gcrs.AlbersEqualArea(),
figsize=(30, 30)
)
deaths_per_mil = cv19["deaths_mean"] / cv19["population"] * 1000000.0
cv19["deaths_per_mil"] = deaths_per_mil
cv19 = contiguous_usa.merge(ihme[is_earthday], left_on="state", right_on="location_name")
is_earthday = ihme["date"]=="2020–04–22"
ihme = pd.read_csv("data/Hospitalization_all_locs.csv")
wget https://ihmecovid19storage.blob.core.windows.net/latest/ihme-covid19.zip
unzip ihme-covid19.zip
mv 2020_*/Hospitalization_all_locs.csv data