Skip to content

Commit 9e9785b

Browse files
authored
CLN: avoid Block.get_values where it is unnecessary (#32707)
1 parent 4603c63 commit 9e9785b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pandas/core/internals/blocks.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,9 @@ def astype(self, dtype, copy: bool = False, errors: str = "raise"):
605605

606606
# astype formatting
607607
else:
608-
values = self.get_values()
608+
# Because we have neither is_extension nor is_datelike,
609+
# self.values already has the correct shape
610+
values = self.values
609611

610612
else:
611613
values = self.get_values(dtype=dtype)
@@ -663,7 +665,7 @@ def _can_hold_element(self, element: Any) -> bool:
663665

664666
def to_native_types(self, slicer=None, na_rep="nan", quoting=None, **kwargs):
665667
""" convert to our native types format, slicing if desired """
666-
values = self.get_values()
668+
values = self.values
667669

668670
if slicer is not None:
669671
values = values[:, slicer]

pandas/core/internals/concat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def get_reindexed_values(self, empty_dtype, upcasted_na):
217217
else:
218218
# No dtype upcasting is done here, it will be performed during
219219
# concatenation itself.
220-
values = self.block.get_values()
220+
values = self.block.values
221221

222222
if not self.indexers:
223223
# If there's no indexing to be done, we want to signal outside

0 commit comments

Comments
 (0)