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}' with pyarrow version {pa.__version__}. '{name}' may be supported by upgrading pyarrow.

What it means

Raised in _reduce when pyarrow.compute has the function but executing it raises AttributeError/NotImplementedError/TypeError for the given dtype. Unlike error 148, the function exists but cannot run — pandas hints that a newer pyarrow may add the missing kernel.

Source

Thrown at pandas/core/arrays/arrow/array.py:2600

        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 71959b8cb9)

Solutions

  1. Upgrade pyarrow to the latest version (`pip install -U pyarrow`) — the message itself recommends this.
  2. Cast to a numeric dtype and reduce: `s.astype("int64[pyarrow]").std()` (watch unit semantics).
  3. Convert to numpy and reduce there if pyarrow semantics aren't required.

Example fix

// before
pd.Series(pd.to_timedelta([1, 2, 3]), dtype="duration[ns][pyarrow]").std()

// after
pip install -U pyarrow
# or
s.astype("int64[pyarrow]").std()
Defensive patterns

Strategy: fallback

Validate before calling

import pyarrow as pa

def min_pyarrow_for(name):
    # rough guidance; verify against pyarrow changelog
    return {"kurt": 13, "median": 14}.get(name, 0)

def ensure_pyarrow(name):
    need = min_pyarrow_for(name)
    if int(pa.__version__.split(".")[0]) < need:
        raise RuntimeError(f"operation '{name}' requires pyarrow >= {need}; have {pa.__version__}")

Type guard

def reduction_runnable(arr, name) -> bool:
    # best-effort: try the pyarrow call on a tiny sample
    import pyarrow as pa
    try:
        sample = pa.array([0, 1], type=arr.dtype.pyarrow_dtype)
        import pyarrow.compute as pc
        getattr(pc, name)(sample)
        return True
    except Exception:
        return False

Try / catch

try:
    s.std()
except TypeError as e:
    if "may be supported by upgrading pyarrow" in str(e):
        s.astype("int64[pyarrow]").std()
    else:
        raise

Prevention

When it happens

Trigger: Calling a reduction that pyarrow exposes but does not implement for the specific dtype — e.g. `median`/`std` on some temporal or duration arrow types, or operations only added in a later pyarrow release.

Common situations: Reductions on duration/decimal/temporal arrow dtypes, or after a pyarrow downgrade that removed a previously-working kernel.

Related errors


AI-assisted analysis of pandas-dev/pandas@71959b8cb9 (2026-08-07). Data as JSON: /api/errors/36496672df97abe4. Report an issue: GitHub.