Skip to content

CLN: _consolidate_inplace less #34389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down