{"record":{"id":"d8f1b1bbb16aa82d","repo":"pandas-dev/pandas","slug":"interpolate-is-not-implemented-for-dtype-self-dty","errorCode":null,"errorMessage":"interpolate is not implemented for dtype={self.dtype}","messagePattern":"interpolate is not implemented for dtype=(.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/arrow/array.py","lineNumber":3198,"sourceCode":"            method == \"linear\"\n            and limit_area is None\n            and limit is None\n            and limit_direction == \"forward\"\n        ):\n            values = self._pa_array.combine_chunks()\n            na_value = pa.array([None], type=values.type)\n            y_diff_2 = pc.fill_null_backward(pc.pairwise_diff_checked(values, period=2))\n            prev_values = pa.concat_arrays([na_value, values[:-2], na_value])\n            interps = pc.add_checked(prev_values, pc.divide_checked(y_diff_2, 2))\n            return self._from_pyarrow_array(pc.coalesce(self._pa_array, interps))\n\n        mask = self.isna()\n        if self.dtype.kind == \"f\":\n            data = self._pa_array.to_numpy()\n        elif self.dtype.kind in \"iu\":\n            data = self.to_numpy(dtype=\"f8\", na_value=0.0)\n        else:\n            raise NotImplementedError(\n                f\"interpolate is not implemented for dtype={self.dtype}\"\n            )\n\n        missing.interpolate_2d_inplace(\n            data,\n            method=method,\n            axis=0,\n            index=index,\n            limit=limit,\n            limit_direction=limit_direction,\n            limit_area=limit_area,\n            mask=mask,\n            **kwargs,\n        )\n        return self._from_pyarrow_array(self._box_pa_array(pa.array(data, mask=mask)))\n\n    @classmethod\n    def _if_else(","sourceCodeStart":3180,"sourceCodeEnd":3216,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/arrays/arrow/array.py#L3180-L3216","documentation":"When interpolate falls back to the numpy-based path (non-fast-path method/limit/area settings), only float (kind 'f') and integer (kind 'iu') dtypes have a to_numpy conversion defined. Any other numeric-ish dtype (e.g. decimal[pyarrow]) hits the else branch and raises NotImplementedError. This complements error 154 by catching exotic numeric dtypes that passed _is_numeric but lack a numpy view path.","triggerScenarios":"Calling .interpolate(method='slinear') or any non-default method on a decimal[pyarrow] or other non-float/int numeric ArrowExtensionArray.","commonSituations":"Decimal128[pyarrow] columns; future numeric pyarrow types that pandas recognizes as numeric but cannot convert cheaply.","solutions":["Cast to float64 before interpolating: s.astype('float64').interpolate(...).","Use the default fast path (method='linear', no limit/limit_area) which stays inside pyarrow for numeric types.","Fall back to .ffill()/.bfill() for non-float numeric dtypes where precision loss is unacceptable."],"exampleFix":"// before\ns = pd.Series([Decimal(\"1\"), None, Decimal(\"3\")], dtype=\"decimal128(8,2)[pyarrow]\")\ns.interpolate(method=\"linear\")\n// after\ns.astype(\"float64\").interpolate(method=\"linear\")","handlingStrategy":"fallback","validationCode":"def safe_interpolate_fallback(s, **kw):\n    if s.dtype.kind not in \"iu\":\n        # only float/int have a numpy fallback path\n        s = s.astype(\"float64\")\n    return s.interpolate(**kw)","typeGuard":"def dtype_has_numpy_view(dtype) -> bool:\n    return dtype.kind in {\"f\", \"i\", \"u\"}","tryCatchPattern":"try:\n    s.interpolate(method=\"linear\")\nexcept NotImplementedError:\n    s.astype(\"float64\").interpolate(method=\"linear\")","preventionTips":["Cast decimal/exotic numeric types to float64 before non-default interpolate methods.","Prefer the default fast-path interpolate for pyarrow numeric types."],"tags":["pyarrow","interpolate","decimal","notimplemented"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}