pandas-dev/pandas · error · TypeError
'{type(self).__name__}' with dtype {self.dtype} does not sup
Error message
'{type(self).__name__}' with dtype {self.dtype} does not support operation '{name}' What it means
Raised in _reduce when `getattr(pyarrow.compute, name)` returns None — i.e. the installed pyarrow version does not expose the requested reduction function at all. This is a static capability miss, not a runtime kernel miss.
Source
Thrown at pandas/core/arrays/arrow/array.py:2574
)[0]
return pc.binary_join(data_list, "")
elif name in ["argmin", "argmax"]:
return super()._reduce(name, skipna=skipna, **kwargs)
else:
pyarrow_name = {
"median": "quantile",
"prod": "product",
"std": "stddev",
"var": "variance",
"kurt": "kurtosis",
}.get(name, name)
# error: Incompatible types in assignment
# (expression has type "Optional[Any]", variable has type
# "Callable[[Any, Any, KwArg(Any)], Any]")
pyarrow_meth = getattr(pc, pyarrow_name, None) # type: ignore[assignment]
if pyarrow_meth is None:
raise TypeError(
f"'{type(self).__name__}' with dtype {self.dtype} "
f"does not support operation '{name}'"
)
# GH51624: pyarrow defaults to min_count=1, pandas behavior is min_count=0
if name in ["any", "all", "sum", "prod"] and "min_count" not in kwargs:
kwargs["min_count"] = 0
elif name == "median":
# GH 52679: Use quantile instead of approximate_median
kwargs["q"] = 0.5
elif name in ["std", "var", "sem"] and "ddof" not in kwargs:
# pyarrow defaults to ddof=0, pandas behavior is ddof=1
kwargs["ddof"] = 1
elif name in ["skew", "kurt"] and "biased" not in kwargs:
kwargs["biased"] = False
try:
result = pyarrow_meth(data_to_reduce, skip_nulls=skipna, **kwargs)View on GitHub (pinned to 71959b8cb9)
Solutions
- Upgrade pyarrow to a version that implements the function: `pip install -U pyarrow`.
- Fall back to numpy-based reduction by converting: `s.to_numpy().kurt()`.
- Pick a supported reduction for the current pyarrow version.
Example fix
// before # pyarrow too old pd.Series([1, 2, 3], dtype="int64[pyarrow]").kurt() // after pip install -U 'pyarrow>=14' pd.Series([1, 2, 3], dtype="int64[pyarrow]").kurt()
Defensive patterns
Strategy: validation
Validate before calling
import pyarrow as pa
import pyarrow.compute as pc
def supports_reduction(name) -> bool:
return getattr(pc, {"median": "quantile", "prod": "product", "std": "stddev", "var": "variance", "kurt": "kurtosis"}.get(name, name), None) is not None Type guard
def pyarrow_has_reduction(name) -> bool:
import pyarrow.compute as pc
mapped = {"median": "quantile", "prod": "product", "std": "stddev", "var": "variance", "kurt": "kurtosis"}.get(name, name)
return hasattr(pc, mapped) Try / catch
try:
s.kurt()
except TypeError as e:
if "does not support operation" in str(e) and "pyarrow version" not in str(e):
s.to_numpy().kurt() # fall back to numpy
else:
raise Prevention
- Pin a modern pyarrow in requirements (>=14) to ensure compute coverage.
- Probe pyarrow.compute for the function name before dispatching generic reductions.
- Have a numpy fallback path for reductions not present in the deployed pyarrow.
When it happens
Trigger: Calling a reduction (e.g. `Series.kurt`, `.skew`, `.sem`) on an ArrowExtensionArray where the running pyarrow version lacks that compute function entirely.
Common situations: Older pyarrow installs (e.g. pinned at <14) lacking newer compute functions like `kurtosis`, or a CI image with an outdated pyarrow.
Related errors
- '{type(self).__name__}' with dtype {self.dtype} does not sup
- Length of 'value' does not match. Got ({len(value)}) expect
- Invalid value '{value!s}' for dtype '{self.dtype}'
- {type(self)} does not support reshape as backed by a 1D pyar
- searchsorted requires array to be sorted, which is impossibl
AI-assisted analysis of pandas-dev/pandas@71959b8cb9 (2026-08-07).
Data as JSON: /api/errors/3d0611b48356b510.
Report an issue: GitHub.