{"record":{"id":"36496672df97abe4","repo":"pandas-dev/pandas","slug":"type-self-name-with-dtype-self-dtype-do-364966","errorCode":null,"errorMessage":"'{type(self).__name__}' with dtype {self.dtype} does not support operation '{name}' with pyarrow version {pa.__version__}. '{name}' may be supported by upgrading pyarrow.","messagePattern":"'(.+?)' with dtype (.+?) does not support operation '(.+?)' with pyarrow version (.+?)\\. '(.+?)' may be supported by upgrading pyarrow\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/arrow/array.py","lineNumber":2600,"sourceCode":"        elif name == \"median\":\n            # GH 52679: Use quantile instead of approximate_median\n            kwargs[\"q\"] = 0.5\n        elif name in [\"std\", \"var\", \"sem\"] and \"ddof\" not in kwargs:\n            # pyarrow defaults to ddof=0, pandas behavior is ddof=1\n            kwargs[\"ddof\"] = 1\n        elif name in [\"skew\", \"kurt\"] and \"biased\" not in kwargs:\n            kwargs[\"biased\"] = False\n\n        try:\n            result = pyarrow_meth(data_to_reduce, skip_nulls=skipna, **kwargs)\n        except (AttributeError, NotImplementedError, TypeError) as err:\n            msg = (\n                f\"'{type(self).__name__}' with dtype {self.dtype} \"\n                f\"does not support operation '{name}' with pyarrow \"\n                f\"version {pa.__version__}. '{name}' may be supported by \"\n                f\"upgrading pyarrow.\"\n            )\n            raise TypeError(msg) from err\n        if name == \"median\":\n            # GH 52679: Use quantile instead of approximate_median; returns array\n            result = result[0]\n\n        if name in [\"min\", \"max\", \"sum\"] and pa.types.is_duration(pa_type):\n            result = result.cast(pa_type)\n        if name in [\"median\", \"mean\"] and pa.types.is_temporal(pa_type):\n            nbits = pa_type.bit_width\n            if nbits == 32:\n                result = result.cast(pa.int32(), safe=False)\n            else:\n                result = result.cast(pa.int64(), safe=False)\n            result = result.cast(pa_type)\n        if name in [\"std\", \"sem\"] and pa.types.is_temporal(pa_type):\n            result = result.cast(pa.int64(), safe=False)\n            if pa.types.is_duration(pa_type):\n                result = result.cast(pa_type)\n            elif pa.types.is_time(pa_type):","sourceCodeStart":2582,"sourceCodeEnd":2618,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/arrays/arrow/array.py#L2582-L2618","documentation":"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.","triggerScenarios":"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.","commonSituations":"Reductions on duration/decimal/temporal arrow dtypes, or after a pyarrow downgrade that removed a previously-working kernel.","solutions":["Upgrade pyarrow to the latest version (`pip install -U pyarrow`) — the message itself recommends this.","Cast to a numeric dtype and reduce: `s.astype(\"int64[pyarrow]\").std()` (watch unit semantics).","Convert to numpy and reduce there if pyarrow semantics aren't required."],"exampleFix":"// before\npd.Series(pd.to_timedelta([1, 2, 3]), dtype=\"duration[ns][pyarrow]\").std()\n\n// after\npip install -U pyarrow\n# or\ns.astype(\"int64[pyarrow]\").std()","handlingStrategy":"fallback","validationCode":"import pyarrow as pa\n\ndef min_pyarrow_for(name):\n    # rough guidance; verify against pyarrow changelog\n    return {\"kurt\": 13, \"median\": 14}.get(name, 0)\n\ndef ensure_pyarrow(name):\n    need = min_pyarrow_for(name)\n    if int(pa.__version__.split(\".\")[0]) < need:\n        raise RuntimeError(f\"operation '{name}' requires pyarrow >= {need}; have {pa.__version__}\")","typeGuard":"def reduction_runnable(arr, name) -> bool:\n    # best-effort: try the pyarrow call on a tiny sample\n    import pyarrow as pa\n    try:\n        sample = pa.array([0, 1], type=arr.dtype.pyarrow_dtype)\n        import pyarrow.compute as pc\n        getattr(pc, name)(sample)\n        return True\n    except Exception:\n        return False","tryCatchPattern":"try:\n    s.std()\nexcept TypeError as e:\n    if \"may be supported by upgrading pyarrow\" in str(e):\n        s.astype(\"int64[pyarrow]\").std()\n    else:\n        raise","preventionTips":["Upgrade pyarrow as the first remediation when the message mentions version.","For duration/temporal types, cast to int64 representation for arithmetic reductions.","Wrap reductions over exotic arrow dtypes with a numpy fallback."],"tags":["arrow","reduce","pyarrow-version","dtype","kernel"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}