Skip to content

Instantly share code, notes, and snippets.

View geo36.py
images = []
for file_name in image_files:
images.append(imageio.imread(file_name))
gif_path = "movie.gif"
imageio.mimsave(gif_path, images, fps=2)
View geo35.py
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")
View geo34.py
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))
View geo33.py
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)
View geo32.py
ax = gplt.choropleth(
cv19,
hue="deaths_per_mil",
edgecolor="white",
linewidth=5,
cmap="Reds",
alpha=0.8,
projection=gcrs.AlbersEqualArea(),
figsize=(30, 30)
)
View geo31.py
deaths_per_mil = cv19["deaths_mean"] / cv19["population"] * 1000000.0
cv19["deaths_per_mil"] = deaths_per_mil
View geo30.py
cv19 = contiguous_usa.merge(ihme[is_earthday], left_on="state", right_on="location_name")
View geo29.py
is_earthday = ihme["date"]=="2020–04–22"
View geo28.py
ihme = pd.read_csv("data/Hospitalization_all_locs.csv")
View geo27.sh
wget https://ihmecovid19storage.blob.core.windows.net/latest/ihme-covid19.zip
unzip ihme-covid19.zip
mv 2020_*/Hospitalization_all_locs.csv data