pandas-dev/pandas · error · NotImplementedError
The 'numba' engine doesn't support list-like/dict likes of…
Error message
The 'numba' engine doesn't support list-like/dict likes of callables yet.
What it means
Raised at the top of `apply_list_or_dict_like` when `engine='numba'` is combined with a list-like or dict-like `func`. The numba engine in DataFrame.apply only supports a single callable operating on each column's values; vectorizing a sequence/dict of callables is not implemented, so pandas fails fast with NotImplementedError rather than silently falling back to the python engine.
Solutions
- Drop `engine='numba'` and use the default python engine for list/dict funcs.
- Apply each callable separately with `engine='numba'` and assemble the results manually: `pd.concat([df.apply(f, engine='numba') for f in [f1, f2]], axis=1)`.
- Verify numba is installed (the python engine fallback path is not taken implicitly here).
Example fix
// before df.apply([f1, f2], engine='numba') // after df.apply([f1, f2]) # python engine
Defensive patterns
Strategy: validation
Validate before calling
def apply_with_engine(df, func, engine='python'):
import collections.abc as cabc
is_multi = isinstance(func, (list, tuple, dict)) or cabc.Mapping
if engine == 'numba' and is_multi:
# fall back to python engine or apply each callable separately
return df.apply(func) # python engine
return df.apply(func, engine=engine) Type guard
def numba_supports_func(func) -> bool:
import collections.abc as cabc
return callable(func) and not isinstance(func, (list, tuple, dict)) and not isinstance(func, cabc.Mapping) Try / catch
try:
out = df.apply(func, engine='numba')
except NotImplementedError as e:
if 'numba' in str(e).lower():
out = df.apply(func) # python fallback
else:
raise Prevention
- Only enable engine='numba' for single-callable apply.
- Gate numba behind a helper that detects list/dict funcs.
- Verify numba is installed before passing engine='numba'.
When it happens
Trigger: `df.apply([f1, f2], engine='numba')`, `df.apply({'A': f1}, engine='numba')`, `df.agg([...], engine='numba')`. Any path that reaches apply_list_or_dict_like with self.engine == 'numba'.
Common situations: Users enable numba for speed on a pipeline that uses list/dict agg specs; copy-pasting `engine='numba'` from a working single-callable call into a multi-function call.
Related errors
- the 'numba' engine doesn't support lists of callables yet
- the 'numba' engine doesn't support result_type='broadcast'
- the 'numba' engine doesn't support using a numpy ufunc as…
- the 'numba' engine doesn't support using a string as the…
- axis other than 0 is not supported
AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11).
Data as JSON: /api/errors/191ceb5e0d2b7bd6.
Report an issue: GitHub.
Appendix: 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 3b7651241d)