polars/polars-join-asof-unsorted
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Polars | info | unsafe, with xpd check --fix --unsafe-fixes |
All versions |
An as-of join needs ascending join keys. Check that each input is sorted by the join key within each group.
df.join_asof(other, on="x", check_sortedness=False)df.sort("x").join_asof(other.sort("x"), on="x")What the rule reports
Section titled “What the rule reports”Descending right keys raised InvalidOperationError with the default sortedness check.
How to fix it
Section titled “How to fix it”With --unsafe-fixes, xpd enables the sortedness check. Sort the inputs if their keys are out of order.
Diagnostic message
Section titled “Diagnostic message”An as-of join needs ascending join keys. Check that each input is sorted by the join key within each group.See all rules in the Polars pack.