diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 8aa8f8bb60654..79805bec85af0 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3369,8 +3369,6 @@ class max_speed nv.validate_take(tuple(), kwargs) - self._consolidate_inplace() - new_data = self._mgr.take( indices, axis=self._get_block_manager_axis(axis), verify=True ) @@ -3508,8 +3506,6 @@ class animal locomotion if axis == 1: return self[key] - self._consolidate_inplace() - index = self.index if isinstance(index, MultiIndex): loc, new_index = self.index.get_loc_level(key, drop_level=drop_level) @@ -5432,7 +5428,6 @@ def values(self) -> np.ndarray: ['lion', 80.5, 1], ['monkey', nan, None]], dtype=object) """ - self._consolidate_inplace() return self._mgr.as_array(transpose=self._AXIS_REVERSED) @property @@ -6101,8 +6096,6 @@ def fillna( inplace = validate_bool_kwarg(inplace, "inplace") value, method = validate_fillna_kwargs(value, method) - self._consolidate_inplace() - # set the default here, so functions examining the signaure # can detect if something was set (e.g. in groupby) (GH9221) if axis is None: @@ -6537,8 +6530,6 @@ def replace( if not is_bool(regex) and to_replace is not None: raise AssertionError("'to_replace' must be 'None' if 'regex' is not a bool") - self._consolidate_inplace() - if value is None: # passing a single value that is scalar like # when value is None (GH5319), for compat diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index 6a7df1c8d88a1..e43c7bf887bcc 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -378,8 +378,6 @@ def apply(self: T, f, align_keys=None, **kwargs) -> T: result_blocks: List[Block] = [] # fillna: Series/DataFrame is responsible for making sure value is aligned - self._consolidate_inplace() - aligned_args = {k: kwargs[k] for k in align_keys} for b in self.blocks: @@ -412,7 +410,6 @@ def apply(self: T, f, align_keys=None, **kwargs) -> T: def quantile( self, axis: int = 0, - consolidate: bool = True, transposed: bool = False, interpolation="linear", qs=None, @@ -426,8 +423,6 @@ def quantile( Parameters ---------- axis: reduction axis, default 0 - consolidate: bool, default True. Join together blocks having same - dtype transposed: bool, default False we are holding transposed data interpolation : type of interpolation, default 'linear' @@ -442,9 +437,6 @@ def quantile( # simplify some of the code here and in the blocks assert self.ndim >= 2 - if consolidate: - self._consolidate_inplace() - def get_axe(block, qs, axes): # Because Series dispatches to DataFrame, we will always have # block.ndim == 2 @@ -675,8 +667,6 @@ def is_mixed_type(self) -> bool: @property def is_numeric_mixed_type(self) -> bool: - # Warning, consolidation needs to get checked upstairs - self._consolidate_inplace() return all(block.is_numeric for block in self.blocks) @property