diff --git a/py-polars/polars/utils/udfs.py b/py-polars/polars/utils/udfs.py index 4278f2a6941c..32716fc44086 100644 --- a/py-polars/polars/utils/udfs.py +++ b/py-polars/polars/utils/udfs.py @@ -536,7 +536,7 @@ def _matches( n_required_ops, argvals = len(opnames), argvals or [] instructions = self._instructions[idx : idx + n_required_ops] if len(instructions) == n_required_ops and all( - any(inst.opname == match_opname for match_opname in match_opnames) + inst.opname in match_opnames and (match_argval is None or inst.argval in match_argval) for inst, match_opnames, match_argval in zip_longest( instructions, opnames, argvals