Skip to content

Commit e5e1fba

Browse files
[ArrayManager] Remove apply_with_block usage for diff() (#40079)
1 parent c3eca7e commit e5e1fba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/core/internals/array_manager.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,13 @@ def putmask(self, mask, new, align: bool = True):
467467
)
468468

469469
def diff(self, n: int, axis: int) -> ArrayManager:
470-
return self.apply_with_block("diff", n=n, axis=axis)
470+
axis = self._normalize_axis(axis)
471+
if axis == 1:
472+
# DataFrame only calls this for n=0, in which case performing it
473+
# with axis=0 is equivalent
474+
assert n == 0
475+
axis = 0
476+
return self.apply(algos.diff, n=n, axis=axis)
471477

472478
def interpolate(self, **kwargs) -> ArrayManager:
473479
return self.apply_with_block("interpolate", **kwargs)

0 commit comments

Comments
 (0)