Add monthwise downloads barplot
This commit is contained in:
parent
86b3659f0f
commit
efa08b4b54
1 changed files with 22 additions and 1 deletions
23
popcorn.py
23
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue