diff --git a/popcorn.py b/popcorn.py index 7a65155..9ed2235 100644 --- a/popcorn.py +++ b/popcorn.py @@ -122,7 +122,6 @@ def _(): .fill_null(0) .unpivot(index="date", variable_name="package", value_name="downloads") ) - df_lazy return @@ -144,6 +143,7 @@ def _(df_lazy: pl.LazyFrame): title="Weekly downloads", ) ) + _() return @@ -181,6 +181,27 @@ def _(df_lazy: pl.LazyFrame): 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