Skip to content

Commit

Permalink
swap order
Browse files Browse the repository at this point in the history
  • Loading branch information
lostmygithubaccount committed Jul 28, 2024
1 parent ddfb89d commit 7b555a7
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions pages/1_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,14 @@
t = (
downloads.mutate(
timestamp=downloads["timestamp"].truncate("D"),
version=downloads["version"].split(".")[0],
)
.group_by("timestamp", "version")
.group_by("timestamp")
.agg(downloads=ibis._["downloads"].sum())
.select(
"timestamp",
"version",
downloads=ibis._["downloads"]
.sum()
.over(
ibis.window(
order_by="timestamp", group_by="version", preceding=28, following=0
)
),
.over(ibis.window(order_by="timestamp", preceding=28, following=0)),
)
.filter((ibis._["timestamp"] >= datetime.now() - timedelta(days=days)))
.order_by("timestamp")
Expand All @@ -139,30 +133,27 @@
t,
x="timestamp",
y="downloads",
color="version",
category_orders={
"version": reversed(
sorted(
t.distinct(on="version")["version"].to_pyarrow().to_pylist(),
key=lambda x: int(x),
)
)
},
title="downloads (28 days rolling) by version",
title="downloads (28 days rolling)",
)
st.plotly_chart(c00, use_container_width=True)

t = (
downloads.mutate(
timestamp=downloads["timestamp"].truncate("D"),
version=downloads["version"].split(".")[0],
)
.group_by("timestamp")
.group_by("timestamp", "version")
.agg(downloads=ibis._["downloads"].sum())
.select(
"timestamp",
"version",
downloads=ibis._["downloads"]
.sum()
.over(ibis.window(order_by="timestamp", preceding=28, following=0)),
.over(
ibis.window(
order_by="timestamp", group_by="version", preceding=28, following=0
)
),
)
.filter((ibis._["timestamp"] >= datetime.now() - timedelta(days=days)))
.order_by("timestamp")
Expand All @@ -172,7 +163,16 @@
t,
x="timestamp",
y="downloads",
title="downloads (28 days rolling)",
color="version",
category_orders={
"version": reversed(
sorted(
t.distinct(on="version")["version"].to_pyarrow().to_pylist(),
key=lambda x: int(x),
)
)
},
title="downloads (28 days rolling) by version",
)
st.plotly_chart(c00, use_container_width=True)

Expand Down

0 comments on commit 7b555a7

Please sign in to comment.