Skip to content

Commit ba21475

Browse files
authored
PERF: DataFrame[object].fillna (#43316)
1 parent 4a14d06 commit ba21475

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/core/internals/blocks.py

+17
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,23 @@ def interpolate(
10841084
# If there are no NAs, then interpolate is a no-op
10851085
return [self] if inplace else [self.copy()]
10861086

1087+
if self.is_object and self.ndim == 2 and self.shape[0] != 1 and axis == 0:
1088+
# split improves performance in ndarray.copy()
1089+
return self.split_and_operate(
1090+
type(self).interpolate,
1091+
method,
1092+
axis,
1093+
index,
1094+
inplace,
1095+
limit,
1096+
limit_direction,
1097+
limit_area,
1098+
fill_value,
1099+
coerce,
1100+
downcast,
1101+
**kwargs,
1102+
)
1103+
10871104
try:
10881105
m = missing.clean_fill_method(method)
10891106
except ValueError:

0 commit comments

Comments
 (0)