{"record":{"id":"bf43a601da7c8462","repo":"pandas-dev/pandas","slug":"type-self-name-does-not-implement-interpola","errorCode":null,"errorMessage":"{type(self).__name__} does not implement interpolate","messagePattern":"(.+?) does not implement interpolate","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/base.py","lineNumber":1298,"sourceCode":"\n        Interpolating values in a FloatingArray:\n\n        >>> arr = pd.array([1.0, pd.NA, 3.0, 4.0, pd.NA, 6.0], dtype=\"Float64\")\n        >>> arr.interpolate(\n        ...     method=\"linear\",\n        ...     axis=0,\n        ...     index=pd.Index(range(len(arr))),\n        ...     limit=None,\n        ...     limit_direction=\"both\",\n        ...     limit_area=None,\n        ...     copy=True,\n        ... )\n        <FloatingArray>\n        [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]\n        Length: 6, dtype: Float64\n        \"\"\"\n        # NB: we return type(self) even if copy=False\n        raise NotImplementedError(\n            f\"{type(self).__name__} does not implement interpolate\"\n        )\n\n    def _pad_or_backfill(\n        self,\n        *,\n        method: FillnaOptions,\n        limit: int | None = None,\n        limit_area: Literal[\"inside\", \"outside\"] | None = None,\n        copy: bool = True,\n    ) -> Self:\n        \"\"\"\n        Pad or backfill values, used by Series/DataFrame ffill and bfill.\n\n        This method propagates the last valid observation forward (pad/ffill)\n        or the next valid observation backward (backfill/bfill) to fill NaN\n        values.\n","sourceCodeStart":1280,"sourceCodeEnd":1316,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/arrays/base.py#L1280-L1316","documentation":"The base ExtensionArray.interpolate raises NotImplementedError naming the subclass: interpolation is dtype-specific (linear needs numeric ordering, time-based needs a DatetimeIndex, etc.) and the base class cannot provide a correct default. Subclasses opt in by overriding interpolate. The source notes the method must return type(self) even when copy=False.","triggerScenarios":"Calling Series.interpolate / DataFrame.interpolate on a column backed by an ExtensionArray whose class did not override interpolate (e.g. a custom categorical-like or string dtype). Internally pandas calls arr.interpolate(...) which hits the base NotImplemented.","commonSituations":"Applying df.interpolate() to a mixed-dtype frame where one non-numeric EA column lacks an interpolate override. Using interpolate(method='time') on a custom EA that only supports numeric data. Third-party dtype without interpolation support.","solutions":["Interpolate only the numeric/temporal columns: df.select_dtypes(include='number').interpolate(), or exclude the unsupported column with df.drop(columns=[...]).interpolate().","If you own the EA, implement interpolate returning type(self) with the desired method handling.","Use fillna (ffill/bfill) as a fallback where appropriate, since _pad_or_backfill has its own (also overridable) default."],"exampleFix":"// before\ndf.interpolate()  # NotImplementedError on custom EA column\n\n// after\ndf.select_dtypes(include='number').interpolate()\n# or fill the unsupported column separately\ndf['custom_col'] = df['custom_col'].fillna(method='ffill')","handlingStrategy":"fallback","validationCode":"from pandas.api.extensions import ExtensionArray\nif getattr(type(arr), 'interpolate', None) is ExtensionArray.interpolate:\n    # base will raise; use fillna instead\n    out = arr.fillna(method='ffill')\nelse:\n    out = arr.interpolate(method='linear', axis=0, index=..., limit=None, limit_direction='both', limit_area=None, copy=True)","typeGuard":"def supports_interpolate(cls) -> bool:\n    return getattr(cls, 'interpolate', None) is not ExtensionArray.interpolate","tryCatchPattern":"try:\n    out = series.interpolate()\nexcept NotImplementedError:\n    out = series.ffill()","preventionTips":["Limit interpolate() to numeric/temporal columns via select_dtypes.","Provide an ffill/bfill fallback for unsupported EA columns.","If you own the EA, implement interpolate to support at least method='linear'."],"tags":["extension-array","not-implemented","interpolation","pandas"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}