diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index d1dc2aa7bd43f..2c73fe5a8b5bc 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -526,7 +526,13 @@ def get_numeric_data(self: T, copy: bool = False) -> T: copy : bool, default False Whether to copy the blocks """ - return self._combine([b for b in self.blocks if b.is_numeric], copy) + numeric_blocks = [blk for blk in self.blocks if blk.is_numeric] + if len(numeric_blocks) == len(self.blocks): + # Avoid somewhat expensive _combine + if copy: + return self.copy(deep=True) + return self + return self._combine(numeric_blocks, copy) def _combine( self: T, blocks: list[Block], copy: bool = True, index: Index | None = None