diff --git a/python/pyspark/pandas/frame.py b/python/pyspark/pandas/frame.py index 9846dc0ae10b7..a7edac5509b14 100644 --- a/python/pyspark/pandas/frame.py +++ b/python/pyspark/pandas/frame.py @@ -6126,6 +6126,13 @@ def interpolate( raise ValueError("invalid limit_direction: '{}'".format(limit_direction)) if (limit_area is not None) and (limit_area not in ["inside", "outside"]): raise ValueError("invalid limit_area: '{}'".format(limit_area)) + for dtype in self.dtypes.values: + if dtype == "object": + warnings.warn( + "DataFrame.interpolate with object dtype is deprecated and will raise in a " + "future version. Convert to a specific numeric type before interpolating.", + FutureWarning, + ) numeric_col_names = [] for label in self._internal.column_labels: diff --git a/python/pyspark/pandas/series.py b/python/pyspark/pandas/series.py index 6d7a7c1f2e567..a35e19545d5a5 100644 --- a/python/pyspark/pandas/series.py +++ b/python/pyspark/pandas/series.py @@ -2231,6 +2231,12 @@ def _interpolate( limit_direction: Optional[str] = None, limit_area: Optional[str] = None, ) -> "Series": + if self.dtype == "object": + warnings.warn( + "Series.interpolate with object dtype is deprecated and will raise in a " + "future version. Convert to a specific numeric type before interpolating.", + FutureWarning, + ) if method not in ["linear"]: raise NotImplementedError("interpolate currently works only for method='linear'") if (limit is not None) and (not limit > 0):