Skip to content

Commit

Permalink
Add monthly plot
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementWalter committed Sep 6, 2023
1 parent e38b96d commit 7c2ea6f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/starksheet-cairo/notebooks/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@
plt.tight_layout()
plt.savefig("daily_sheets.png")

# %% Plot monthly
counts = (
calls.groupby(["contract_identifier", pd.Grouper(key="timestamp", freq="M")])
.size()
.unstack("contract_identifier", fill_value=0)
.fillna(0)
.astype(int)
)
ax = counts.plot(kind="bar", stacked=True)
x_labels = [d.date().strftime("%Y-%m") for d in counts.index]
ax.set_xticklabels(x_labels)
ax.grid(axis="y", linestyle="--", color="grey")
plt.tight_layout()
plt.savefig("monthly_sheets.png")

# %% Plot hourly sheet creation
plt.clf()
ax = (
Expand Down

0 comments on commit 7c2ea6f

Please sign in to comment.