Skip to content

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")

Descending right keys raised InvalidOperationError with the default sortedness check.

With --unsafe-fixes, xpd enables the sortedness check. Sort the inputs if their keys are out of order.

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.