pandas-dev/pandas · error · NotImplementedError

{type(self).__name__} does not implement interpolate

Error message

{type(self).__name__} does not implement interpolate

What it means

Default ExtensionArray.interpolate (base.py:1298) raises NotImplementedError because interpolation is dtype-specific and the base class cannot provide a correct generic implementation. Subclasses like FloatingArray and NumpyExtensionArray override it; any ExtensionArray subclass that does not will hit this stub. The message names the offending class so the user knows which type lacks support.

Source

Thrown at pandas/core/arrays/base.py:1298

        Interpolating values in a FloatingArray:

        >>> arr = pd.array([1.0, pd.NA, 3.0, 4.0, pd.NA, 6.0], dtype="Float64")
        >>> arr.interpolate(
        ...     method="linear",
        ...     axis=0,
        ...     index=pd.Index(range(len(arr))),
        ...     limit=None,
        ...     limit_direction="both",
        ...     limit_area=None,
        ...     copy=True,
        ... )
        <FloatingArray>
        [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
        Length: 6, dtype: Float64
        """
        # NB: we return type(self) even if copy=False
        raise NotImplementedError(
            f"{type(self).__name__} does not implement interpolate"
        )

    def _pad_or_backfill(
        self,
        *,
        method: FillnaOptions,
        limit: int | None = None,
        limit_area: Literal["inside", "outside"] | None = None,
        copy: bool = True,
    ) -> Self:
        """
        Pad or backfill values, used by Series/DataFrame ffill and bfill.

        This method propagates the last valid observation forward (pad/ffill)
        or the next valid observation backward (backfill/bfill) to fill NaN
        values.

View on GitHub (pinned to 71959b8cb9)

Solutions

  1. Override interpolate() in your ExtensionArray subclass, returning type(self).
  2. Convert the column to a supported dtype before interpolating, e.g. s.astype('Float64').interpolate(...).
  3. Use fillna/ffill/bfill instead of interpolate for non-numeric dtypes.
  4. If working with a custom EA from a library, upgrade that library or open an issue requesting interpolate support.

Example fix

# before
class MyEA(ExtensionArray): ...
s_my.interpolate(method="linear", ...)  # raises

# after (subclass)
def interpolate(self, *, method, axis, index, limit, limit_direction, limit_area, copy, **kwargs):
    return self  # or real impl
Defensive patterns

Strategy: type-guard

Validate before calling

def supports_interpolate(s):
    import pandas as pd
    return s.dtype.kind in "iufcb" or pd.api.types.is_float_dtype(s)

Type guard

def is_interpolatable_dtype(dtype) -> bool:
    import pandas as pd as _
    return dtype.kind in ("i", "u", "f", "c", "b") or str(dtype) in ("Float64", "Float32", "Int64", "Int32")

Try / catch

try:
    s.interpolate(method="linear", axis=0, index=s.index, limit=None, limit_direction="forward", limit_area=None, copy=True)
except NotImplementedError as e:
    if "does not implement interpolate" in str(e):
        s = s.astype("Float64").interpolate(method="linear", axis=0, index=s.index, limit=None, limit_direction="forward", limit_area=None, copy=True)
    else:
        raise

Prevention

When it happens

Trigger: Calling .interpolate() (or DataFrame.interpolate) on a column backed by an ExtensionArray subclass that does not override interpolate (e.g. a custom EA, or some non-numeric EAs). Also reached via Series.interpolate(method=...) dispatch.

Common situations: Authoring a third-party ExtensionArray and forgetting to implement interpolate; calling interpolate on a categorical/string-dtype column expecting fill behavior; version upgrade where interpolation dispatch changed.

Related errors


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