pandas-dev/pandas · error · NotImplementedError

interpolate is not implemented for dtype=

Error message

interpolate is not implemented for dtype={self.dtype}

What it means

Raised by BaseMaskedArray._interpolate when the dtype kind is neither 'f' (float) nor 'iu' (integer). Interpolation is only implemented for numeric masked arrays; boolean and other kinds cannot be interpolated and raise NotImplementedError.

Solutions

  1. Use a fill method valid for the dtype: ffill(), bfill(), or fillna(mode).
  2. Cast the column to a numeric dtype before interpolation if the data supports it.
  3. Skip non-numeric columns when applying interpolate in a column-wise loop.

Example fix

// before
bool_arr.interpolate()   # raises
// after
bool_arr.ffill()         # valid fill for boolean
Defensive patterns

Strategy: validation

Validate before calling

if arr.dtype.kind not in 'fiu':
    result = arr.ffill()
else:
    result = arr.interpolate()

Type guard

def is_interpolatable(arr) -> bool:
    return arr.dtype.kind in 'fiu'

Try / catch

try:
    result = arr.interpolate()
except NotImplementedError as e:
    if 'interpolate is not implemented' in str(e):
        result = arr.ffill()
    else:
        raise

Prevention

When it happens

Trigger: Calling interpolate (e.g. Series.interpolate backed by a masked array) on a nullable 'boolean' ExtensionArray, or any masked array whose dtype.kind is not in 'fiu'.

Common situations: Applying interpolate() to a boolean column with NAs expecting it to fill forward; running a generic NA-handling pipeline that calls interpolate on every column regardless of dtype.

Related errors


AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11). Data as JSON: /api/errors/b81de3ef72dc0f9a. Report an issue: GitHub.

Appendix: source

Thrown at pandas/core/arrays/masked.py:2125

        **kwargs,
    ) -> FloatingArray:
        """
        See NDFrame.interpolate.__doc__.
        """
        # NB: we return type(self) even if copy=False
        if self.dtype.kind == "f":
            if copy:
                data = self._data.copy()
                mask = self._mask.copy()
            else:
                data = self._data
                mask = self._mask
        elif self.dtype.kind in "iu":
            copy = True
            data = self._data.astype("f8")
            mask = self._mask.copy()
        else:
            raise NotImplementedError(
                f"interpolate is not implemented for dtype={self.dtype}"
            )

        missing.interpolate_2d_inplace(
            data,
            method=method,
            axis=0,
            index=index,
            limit=limit,
            limit_direction=limit_direction,
            limit_area=limit_area,
            mask=mask,
            **kwargs,
        )
        if not copy:
            return self  # type: ignore[return-value]
        if self.dtype.kind == "f":
            return type(self)._simple_new(data, mask)  # type: ignore[return-value]

View on GitHub (pinned to 3b7651241d)