Improve package updates barplot with least updated

This commit is contained in:
Marty Oehme 2025-09-29 10:07:49 +02:00
parent 43d2bac7ad
commit bc6c9d1002
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -227,21 +227,30 @@ def _(df_lazy: pl.LazyFrame):
@app.cell
def _(df_pkg_lazy: pl.LazyFrame):
DISPLAY_TOP = 20
df_top_pkg_dl = (
df_pkg_lazy.group_by("package")
.agg(pl.col("downloads").sum())
.sort("downloads", descending=True)
.head(DISPLAY_TOP)
.collect()
)
df_pkg_dl = df_pkg_lazy.group_by("package").agg(pl.col("downloads").sum()).collect()
(
lp.ggplot(df_top_pkg_dl, lp.aes("package", "downloads"))
+ lp.geom_bar(stat="identity")
+ lp.labs(
title="Top packages",
caption="Daily number of unique providers for package update statistics opting in to popcorn.",
)
lp.gggrid(
[
lp.ggplot(
df_pkg_dl.sort("downloads", descending=True).head(DISPLAY_TOP),
lp.aes("package", "downloads"),
)
+ lp.geom_bar(stat="identity")
+ lp.labs(
title="Top packages",
caption="Most updated packages over all time",
),
lp.ggplot(
df_pkg_dl.sort("downloads", descending=False).head(DISPLAY_TOP),
lp.aes("package", "downloads"),
)
+ lp.geom_bar(stat="identity")
+ lp.labs(
title="Rarest packages",
caption="Least updated packages over all time",
),
],
ncol=1,
)
return