CLN: enforce deprecation of NDFrame.interpolate with ffill/bfill/pad/backfill methods by natmokval · Pull Request #57869 · pandas-dev/pandas (original) (raw)

Just to be clear, here's the diff of the change I think you can fully clean up (I think we don't need any logic dealing with checking for a fillna_method):

--- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -7797,30 +7797,11 @@ class NDFrame(PandasObject, indexing.IndexingMixin): if not isinstance(method, str): raise ValueError("'method' should be a string, not None.") - fillna_methods = ["ffill", "bfill", "pad", "backfill"] - if method.lower() in fillna_methods: - # GH#53581 - warnings.warn( - f"{type(self).name}.interpolate with method={method} is " - "deprecated and will raise in a future version. " - "Use obj.ffill() or obj.bfill() instead.", - FutureWarning, - stacklevel=find_stack_level(), - ) - obj, should_transpose = self, False - else: - obj, should_transpose = (self.T, True) if axis == 1 else (self, False) - f"{type(self).name} cannot interpolate with object dtype." - )

@@ -7830,34 +7811,16 @@ class NDFrame(PandasObject, indexing.IndexingMixin): limit_direction = missing.infer_limit_direction(limit_direction, method) - if method.lower() in fillna_methods: - # TODO(3.0): remove this case - # TODO: warn/raise on limit_direction or kwargs which are ignored? - # as of 2023-06-26 no tests get here with either - if not self._mgr.is_single_block and axis == 1: - # GH#53898 - if inplace: - raise NotImplementedError() - obj, axis, should_transpose = self.T, 1 - axis, True