{"record":{"id":"191ceb5e0d2b7bd6","repo":"pandas-dev/pandas","slug":"the-numba-engine-doesn-t-support-list-like-dict","errorCode":null,"errorMessage":"The 'numba' engine doesn't support list-like/dict likes of callables yet.","messagePattern":"The 'numba' engine doesn't support list-like/dict likes of callables yet\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"pandas/core/apply.py","lineNumber":755,"sourceCode":"                raise ValueError(f\"Operation {func} does not support axis=1\")\n            if \"axis\" in arg_names and not isinstance(\n                obj, (SeriesGroupBy, DataFrameGroupBy)\n            ):\n                self.kwargs[\"axis\"] = self.axis\n        return self._apply_str(obj, func, *self.args, **self.kwargs)\n\n    def apply_list_or_dict_like(self) -> DataFrame | Series:\n        \"\"\"\n        Compute apply in case of a list-like or dict-like.\n\n        Returns\n        -------\n        result: Series, DataFrame, or None\n            Result when self.func is a list-like or dict-like, None otherwise.\n        \"\"\"\n\n        if self.engine == \"numba\":\n            raise NotImplementedError(\n                \"The 'numba' engine doesn't support list-like/\"\n                \"dict likes of callables yet.\"\n            )\n\n        if self.axis == 1 and isinstance(self.obj, ABCDataFrame):\n            return self.obj.T.apply(self.func, 0, args=self.args, **self.kwargs).T\n\n        func = self.func\n        kwargs = self.kwargs\n\n        if is_dict_like(func):\n            result = self.agg_or_apply_dict_like(op_name=\"apply\")\n        else:\n            result = self.agg_or_apply_list_like(op_name=\"apply\")\n\n        result = reconstruct_and_relabel_result(result, func, **kwargs)\n\n        return result","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/apply.py#L737-L773","documentation":"Raised in `apply_list_or_dict_like` when `engine='numba'` is requested together with a list-like or dict-like `func`. The numba engine in `apply` only supports a single callable operating on raw numpy values; iterating over multiple callables or column-specific mappings is not implemented.","triggerScenarios":"`df.apply(['sum', 'mean'], engine='numba')` or `df.apply({'A': 'sum'}, engine='numba')`. The check at apply.py:754 fires before any numba work begins.","commonSituations":"Trying to speed up multi-function aggregations with numba; copy-pasting engine='numba' from a working single-callable call into a list-based call; assuming numba supports the full agg surface.","solutions":["Drop `engine='numba'` (use the default 'python' engine) for list/dict func.","Call each function separately with the numba engine if each is a single compatible callable: `[df.apply(f, engine='numba') for f in funcs]`.","Reimplement the multi-function logic as one combined callable suitable for numba."],"exampleFix":"# before\ndf.apply(['sum', 'mean'], engine='numba')\n# after\ndf.agg(['sum', 'mean'])  # python engine\n# or per-function numba\ndf.apply(my_single_func, engine='numba', raw=True)","handlingStrategy":"validation","validationCode":"def safe_apply(df, func, engine='python', **kw):\n    import collections.abc\n    if engine == 'numba' and isinstance(func, (list, tuple, dict)):\n        raise ValueError('numba engine requires a single callable, not list/dict')\n    return df.apply(func, engine=engine, **kw)","typeGuard":"def is_single_callable_for_numba(func, engine) -> bool:\n    import collections.abc, typing\n    return engine != 'numba' or (callable(func) and not isinstance(func, (list, tuple, dict)))","tryCatchPattern":"try:\n    df.apply(func, engine='numba')\nexcept NotImplementedError as e:\n    if 'numba' in str(e).lower():\n        df.apply(func)  # fall back to python engine\n    else:\n        raise","preventionTips":["Reserve `engine='numba'` for single-callable apply calls only.","Document the numba engine's limitations for teammates."],"tags":["pandas","apply","numba","notimplementederror","engine"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}