Add monthwise downloads barplot

This commit is contained in:
Marty Oehme 2025-09-28 21:11:14 +02:00
parent 86b3659f0f
commit efa08b4b54
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -122,7 +122,6 @@ def _():
.fill_null(0) .fill_null(0)
.unpivot(index="date", variable_name="package", value_name="downloads") .unpivot(index="date", variable_name="package", value_name="downloads")
) )
df_lazy
return return
@ -144,6 +143,7 @@ def _(df_lazy: pl.LazyFrame):
title="Weekly downloads", title="Weekly downloads",
) )
) )
_() _()
return return
@ -181,6 +181,27 @@ def _(df_lazy: pl.LazyFrame):
caption="Downloads aggregated per day of the week they took place.", caption="Downloads aggregated per day of the week they took place.",
) )
) )
_()
return
@app.cell
def _(df_lazy: pl.LazyFrame):
def _():
month_agg_downloads = (
df_lazy.sort("date")
.with_columns(pl.col("date").dt.month().alias("month"))
.collect()
)
return (
lp.ggplot(month_agg_downloads, lp.aes("month", "downloads"))
+ lp.geom_bar()
+ lp.labs(
title="Monthwise downloads",
caption="Downloads aggregated per month of the year.",
)
)
_() _()
return return