From ab0caf139307bdd04b38e32a8ed998974be144dc Mon Sep 17 00:00:00 2001 From: Brock Date: Mon, 30 Aug 2021 18:25:42 -0700 Subject: [PATCH] PERF: DataFrame[object].fillna --- pandas/core/internals/blocks.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 88183a4571327..3b31e1b2997c6 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -1084,6 +1084,23 @@ def interpolate( # If there are no NAs, then interpolate is a no-op return [self] if inplace else [self.copy()] + if self.is_object and self.ndim == 2 and self.shape[0] != 1 and axis == 0: + # split improves performance in ndarray.copy() + return self.split_and_operate( + type(self).interpolate, + method, + axis, + index, + inplace, + limit, + limit_direction, + limit_area, + fill_value, + coerce, + downcast, + **kwargs, + ) + try: m = missing.clean_fill_method(method) except ValueError: