pandas-dev/pandas · error · TypeError
' ' with dtype does not support operation ' ' with pyarrow…
Error message
'{type(self).__name__}' with dtype {self.dtype} does not support operation '{name}' with pyarrow version {pa.__version__}. '{name}' may be supported by upgrading pyarrow. What it means
The companion guard to 146: when pyarrow.compute has the named function but invoking it raises AttributeError, NotImplementedError, or TypeError (typically because the installed pyarrow lacks a kernel for this dtype), pandas reports that the operation may be supported by upgrading pyarrow. The current and operation names are included to guide the upgrade.
Solutions
- Upgrade pyarrow to the latest version (pip install -U pyarrow).
- Cast to numpy dtype and compute the statistic with scipy/numpy instead.
- Pin pandas and pyarrow to compatible versions per pandas release notes.
Example fix
// before # pyarrow too old s = pd.Series([1., 2., 3.], dtype="double[pyarrow]") s.kurt() // after pip install -U pyarrow s = pd.Series([1., 2., 3.], dtype="double[pyarrow]") s.kurt()
Defensive patterns
Strategy: retry
Validate before calling
import pyarrow as pa
def pyarrow_supports(name, min_version="10.0.0") -> bool:
from packaging.version import Version
return Version(pa.__version__) >= Version(min_version) Type guard
import pyarrow as pa
def pyarrow_recent_enough(min_version="12.0.0") -> bool:
from packaging.version import Version
return Version(pa.__version__) >= Version(min_version) Try / catch
try:
s.kurt()
except TypeError as e:
if "upgrading pyarrow" in str(e):
s.astype("float64").kurt() # fallback before upgrade
else:
raise Prevention
- Pin pandas and pyarrow to versions released together.
- Upgrade pyarrow alongside pandas in CI.
- Provide a numpy/scipy fallback for advanced statistics.
When it happens
Trigger: Calling a reduction (e.g. .skew(), .kurt(), .sem(), .median()) whose pyarrow.compute kernel exists but fails for the array's pyarrow type, on an older pyarrow install.
Common situations: CI or production environments pinning an older pyarrow; user upgrades pandas without upgrading pyarrow; new reduction added to pandas not yet available in the user's pyarrow.
Related errors
- ' ' with dtype does not support operation
- pyarrow>= is required for PyArrow backed…
- ambiguous is not supported.
- is not supported
- ArrowStringArray requires a PyArrow (chunked) array of…
AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11).
Data as JSON: /api/errors/36496672df97abe4.
Report an issue: GitHub.
Appendix: source
Thrown at pandas/core/arrays/arrow/array.py:2625
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)
except (AttributeError, NotImplementedError, TypeError) as err:
msg = (
f"'{type(self).__name__}' with dtype {self.dtype} "
f"does not support operation '{name}' with pyarrow "
f"version {pa.__version__}. '{name}' may be supported by "
f"upgrading pyarrow."
)
raise TypeError(msg) from err
if name == "median":
# GH 52679: Use quantile instead of approximate_median; returns array
result = result[0]
if name in ["min", "max", "sum"] and pa.types.is_duration(pa_type):
result = result.cast(pa_type)
if name in ["median", "mean"] and pa.types.is_temporal(pa_type):
nbits = pa_type.bit_width
if nbits == 32:
result = result.cast(pa.int32(), safe=False)
else:
result = result.cast(pa.int64(), safe=False)
result = result.cast(pa_type)
if name in ["std", "sem"] and pa.types.is_temporal(pa_type):
result = result.cast(pa.int64(), safe=False)
if pa.types.is_duration(pa_type):
result = result.cast(pa_type)
elif pa.types.is_time(pa_type):View on GitHub (pinned to 3b7651241d)