pandas-dev/pandas · error · NotImplementedError
The 'numba' engine doesn't support list-like/dict likes of c
Error message
The 'numba' engine doesn't support list-like/dict likes of callables yet.
What it means
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.
Source
Thrown at pandas/core/apply.py:755
raise ValueError(f"Operation {func} does not support axis=1")
if "axis" in arg_names and not isinstance(
obj, (SeriesGroupBy, DataFrameGroupBy)
):
self.kwargs["axis"] = self.axis
return self._apply_str(obj, func, *self.args, **self.kwargs)
def apply_list_or_dict_like(self) -> DataFrame | Series:
"""
Compute apply in case of a list-like or dict-like.
Returns
-------
result: Series, DataFrame, or None
Result when self.func is a list-like or dict-like, None otherwise.
"""
if self.engine == "numba":
raise NotImplementedError(
"The 'numba' engine doesn't support list-like/"
"dict likes of callables yet."
)
if self.axis == 1 and isinstance(self.obj, ABCDataFrame):
return self.obj.T.apply(self.func, 0, args=self.args, **self.kwargs).T
func = self.func
kwargs = self.kwargs
if is_dict_like(func):
result = self.agg_or_apply_dict_like(op_name="apply")
else:
result = self.agg_or_apply_list_like(op_name="apply")
result = reconstruct_and_relabel_result(result, func, **kwargs)
return resultView on GitHub (pinned to 71959b8cb9)
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.
Example fix
# before df.apply(['sum', 'mean'], engine='numba') # after df.agg(['sum', 'mean']) # python engine # or per-function numba df.apply(my_single_func, engine='numba', raw=True)
Defensive patterns
Strategy: validation
Validate before calling
def safe_apply(df, func, engine='python', **kw):
import collections.abc
if engine == 'numba' and isinstance(func, (list, tuple, dict)):
raise ValueError('numba engine requires a single callable, not list/dict')
return df.apply(func, engine=engine, **kw) Type guard
def is_single_callable_for_numba(func, engine) -> bool:
import collections.abc, typing
return engine != 'numba' or (callable(func) and not isinstance(func, (list, tuple, dict))) Try / catch
try:
df.apply(func, engine='numba')
except NotImplementedError as e:
if 'numba' in str(e).lower():
df.apply(func) # fall back to python engine
else:
raise Prevention
- Reserve `engine='numba'` for single-callable apply calls only.
- Document the numba engine's limitations for teammates.
When it happens
Trigger: `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.
Common situations: 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.
Related errors
- the 'numba' engine doesn't support lists of callables yet
- the 'numba' engine doesn't support using a string as the cal
- the 'numba' engine doesn't support using a numpy ufunc as th
- the 'numba' engine doesn't support result_type='broadcast'
- Parallel apply is not supported when raw=False and engine='n
AI-assisted analysis of pandas-dev/pandas@71959b8cb9 (2026-08-07).
Data as JSON: /api/errors/191ceb5e0d2b7bd6.
Report an issue: GitHub.