calendar heatmap

PHOTO EMBED

Wed Mar 06 2024 03:14:45 GMT+0000 (Coordinated Universal Time)

Saved by @Milados

import calmap

temp_df = df.groupby(["state_id", "date"])["value"].sum()
temp_df = temp_df.reset_index()
temp_df = temp_df.set_index("date")

fig, axs = plt.subplots(3, 1, figsize=(10, 10))
calmap.yearplot(temp_df.loc[temp_df["state_id"] == "CA", "value"], year=2015, ax=axs[0])
axs[0].set_title("CA")
calmap.yearplot(temp_df.loc[temp_df["state_id"] == "TX", "value"], year=2015, ax=axs[1])
axs[1].set_title("TX")
calmap.yearplot(temp_df.loc[temp_df["state_id"] == "WI", "value"], year=2015, ax=axs[2])
axs[2].set_title("WI")
content_copyCOPY