{"record":{"id":"8d780f4b60d6c07d","repo":"pola-rs/polars","slug":"you-should-pass-the-column-to-join-on-as-an-argume","errorCode":null,"errorMessage":"you should pass the column to join on as an argument","messagePattern":"you should pass the column to join on as an argument","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/frame.py","lineNumber":6127,"sourceCode":"        │ str         ┆ date       ┆ f64        ┆ i64  │\n        ╞═════════════╪════════════╪════════════╪══════╡\n        │ Germany     ┆ 2016-03-01 ┆ 82.19      ┆ 4164 │\n        │ Germany     ┆ 2018-08-01 ┆ 82.66      ┆ 4696 │\n        │ Germany     ┆ 2019-01-01 ┆ 83.12      ┆ 4696 │\n        │ Netherlands ┆ 2016-03-01 ┆ 17.11      ┆ 784  │\n        │ Netherlands ┆ 2018-08-01 ┆ 17.32      ┆ 910  │\n        │ Netherlands ┆ 2019-01-01 ┆ 17.4       ┆ 910  │\n        └─────────────┴────────────┴────────────┴──────┘\n        \"\"\"\n        require_same_type(self, other)\n\n        if isinstance(on, (str, pl.Expr)):\n            left_on = on\n            right_on = on\n\n        if left_on is None or right_on is None:\n            msg = \"you should pass the column to join on as an argument\"\n            raise ValueError(msg)\n\n        if by is not None:\n            by_left_ = [by] if isinstance(by, str) else by\n            by_right_ = by_left_\n        elif (by_left is not None) or (by_right is not None):\n            by_left_ = [by_left] if isinstance(by_left, str) else by_left  # type: ignore[assignment]\n            by_right_ = [by_right] if isinstance(by_right, str) else by_right  # type: ignore[assignment]\n\n        else:\n            # no by\n            by_left_ = None\n            by_right_ = None\n\n        tolerance_str: str | None = None\n        tolerance_num: float | int | None = None\n        if isinstance(tolerance, str):\n            tolerance_str = tolerance\n        elif isinstance(tolerance, timedelta):","sourceCodeStart":6109,"sourceCodeEnd":6145,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/lazyframe/frame.py#L6109-L6145","documentation":"LazyFrame.join_asof() requires the join key: either on= (applied to both frames) or both left_on= and right_on=. If neither combination is provided, polars raises ValueError before building the plan. Unlike regular join, join_asof has no default key inference.","triggerScenarios":"lf.join_asof(other) with no key arguments; passing only left_on='ts' without right_on; keys held in variables that are unexpectedly None.","commonSituations":"Time-series joins (asof joins on timestamps) where the key column names differ per frame or were refactored; optional key parameters defaulting to None in wrapper functions.","solutions":["Pass on='timestamp' when both frames use the same key column name","Otherwise pass left_on='ts_left', right_on='ts_right' together","In wrapper functions, validate that at least one key argument is set before delegating to join_asof"],"exampleFix":"# before\nlf.join_asof(other, by='group')\n\n# after\nlf.join_asof(other, on='timestamp', by='group')","handlingStrategy":"validation","validationCode":"if on is None and (left_on is None or right_on is None):\n    raise ValueError('join_asof requires on=, or both left_on= and right_on=')\nlf.join_asof(other, on=on, left_on=left_on, right_on=right_on)","typeGuard":"def has_asof_key(on, left_on, right_on) -> bool:\n    return on is not None or (left_on is not None and right_on is not None)","tryCatchPattern":null,"preventionTips":["Set on= as the default in asof join wrappers","Fail fast with your own message before delegating to join_asof","Sort both frames by the asof key before joining"],"tags":["polars","lazyframe","join-asof","missing-argument"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}