polars/polars-groupby-join-over
| Rule | polars-groupby-join-over |
|---|---|
| Pack | Polars |
| Severity | info |
| Fix | none, edit by hand |
| Library versions | every version |
A join to an aggregation of the same Polars frame can often be written as a window expression. Check the output names and how null keys should be grouped.
df.join(df.group_by("y").agg(total=expr.sum()), on="y")df.with_columns(total=expr.sum().over("y"))What the rule reports
Section titled “What the rule reports”Three rows with non-null keys gave equal frames.
How to fix it
Section titled “How to fix it”Edit the code using the replacement in the example.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
A join to an aggregation of the same Polars frame can often be written as a window expression. Check the output names and how null keys should be grouped.Browse the other rules of the Polars pack.