Skip to content

Commit 760ba37

Browse files
authored
CLN: _consolidate_inplace less (pandas-dev#34389)
1 parent fc6dd8d commit 760ba37

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

pandas/core/generic.py

-9
Original file line numberDiff line numberDiff line change
@@ -3369,8 +3369,6 @@ class max_speed
33693369

33703370
nv.validate_take(tuple(), kwargs)
33713371

3372-
self._consolidate_inplace()
3373-
33743372
new_data = self._mgr.take(
33753373
indices, axis=self._get_block_manager_axis(axis), verify=True
33763374
)
@@ -3508,8 +3506,6 @@ class animal locomotion
35083506
if axis == 1:
35093507
return self[key]
35103508

3511-
self._consolidate_inplace()
3512-
35133509
index = self.index
35143510
if isinstance(index, MultiIndex):
35153511
loc, new_index = self.index.get_loc_level(key, drop_level=drop_level)
@@ -5432,7 +5428,6 @@ def values(self) -> np.ndarray:
54325428
['lion', 80.5, 1],
54335429
['monkey', nan, None]], dtype=object)
54345430
"""
5435-
self._consolidate_inplace()
54365431
return self._mgr.as_array(transpose=self._AXIS_REVERSED)
54375432

54385433
@property
@@ -6101,8 +6096,6 @@ def fillna(
61016096
inplace = validate_bool_kwarg(inplace, "inplace")
61026097
value, method = validate_fillna_kwargs(value, method)
61036098

6104-
self._consolidate_inplace()
6105-
61066099
# set the default here, so functions examining the signaure
61076100
# can detect if something was set (e.g. in groupby) (GH9221)
61086101
if axis is None:
@@ -6537,8 +6530,6 @@ def replace(
65376530
if not is_bool(regex) and to_replace is not None:
65386531
raise AssertionError("'to_replace' must be 'None' if 'regex' is not a bool")
65396532

6540-
self._consolidate_inplace()
6541-
65426533
if value is None:
65436534
# passing a single value that is scalar like
65446535
# when value is None (GH5319), for compat

pandas/core/internals/managers.py

-10
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,6 @@ def apply(self: T, f, align_keys=None, **kwargs) -> T:
378378
result_blocks: List[Block] = []
379379
# fillna: Series/DataFrame is responsible for making sure value is aligned
380380

381-
self._consolidate_inplace()
382-
383381
aligned_args = {k: kwargs[k] for k in align_keys}
384382

385383
for b in self.blocks:
@@ -412,7 +410,6 @@ def apply(self: T, f, align_keys=None, **kwargs) -> T:
412410
def quantile(
413411
self,
414412
axis: int = 0,
415-
consolidate: bool = True,
416413
transposed: bool = False,
417414
interpolation="linear",
418415
qs=None,
@@ -426,8 +423,6 @@ def quantile(
426423
Parameters
427424
----------
428425
axis: reduction axis, default 0
429-
consolidate: bool, default True. Join together blocks having same
430-
dtype
431426
transposed: bool, default False
432427
we are holding transposed data
433428
interpolation : type of interpolation, default 'linear'
@@ -442,9 +437,6 @@ def quantile(
442437
# simplify some of the code here and in the blocks
443438
assert self.ndim >= 2
444439

445-
if consolidate:
446-
self._consolidate_inplace()
447-
448440
def get_axe(block, qs, axes):
449441
# Because Series dispatches to DataFrame, we will always have
450442
# block.ndim == 2
@@ -675,8 +667,6 @@ def is_mixed_type(self) -> bool:
675667

676668
@property
677669
def is_numeric_mixed_type(self) -> bool:
678-
# Warning, consolidation needs to get checked upstairs
679-
self._consolidate_inplace()
680670
return all(block.is_numeric for block in self.blocks)
681671

682672
@property

0 commit comments

Comments
 (0)