From 406ec260b7b8eaa0287ba8376b509f1c6b23becd Mon Sep 17 00:00:00 2001 From: Brock Date: Sun, 16 Jan 2022 11:18:38 -0800 Subject: [PATCH] CLN: consolidate arg no longer needed --- pandas/core/base.py | 6 +++--- pandas/core/generic.py | 4 ---- pandas/core/indexing.py | 4 +--- pandas/core/internals/array_manager.py | 1 - pandas/core/internals/base.py | 3 --- pandas/core/internals/managers.py | 5 ----- 6 files changed, 4 insertions(+), 19 deletions(-) diff --git a/pandas/core/base.py b/pandas/core/base.py index 504b6d507a87e..075b1437992a4 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -224,9 +224,9 @@ def _obj_with_exclusions(self): if len(self.exclusions) > 0: # equivalent to `self.obj.drop(self.exclusions, axis=1) # but this avoids consolidating and making a copy - return self.obj._drop_axis( - self.exclusions, axis=1, consolidate=False, only_slice=True - ) + # TODO: following GH#45287 can we now use .drop directly without + # making a copy? + return self.obj._drop_axis(self.exclusions, axis=1, only_slice=True) else: return self.obj diff --git a/pandas/core/generic.py b/pandas/core/generic.py index e42b18c6b993e..9b713e626ad24 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4259,7 +4259,6 @@ def _drop_axis( axis, level=None, errors: str = "raise", - consolidate: bool_t = True, only_slice: bool_t = False, ) -> NDFrameT: """ @@ -4274,8 +4273,6 @@ def _drop_axis( For MultiIndex errors : {'ignore', 'raise'}, default 'raise' If 'ignore', suppress error and existing labels are dropped. - consolidate : bool, default True - Whether to call consolidate_inplace in the reindex_indexer call. only_slice : bool, default False Whether indexing along columns should be view-only. @@ -4329,7 +4326,6 @@ def _drop_axis( indexer, axis=bm_axis, allow_dups=True, - consolidate=consolidate, only_slice=only_slice, ) result = self._constructor(new_mgr) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 0bf6f22c2d385..ba2af6acbbb08 100644 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -698,9 +698,7 @@ def _ensure_listlike_indexer(self, key, axis=None, value=None): # GH#38148 keys = self.obj.columns.union(key, sort=False) - self.obj._mgr = self.obj._mgr.reindex_axis( - keys, axis=0, consolidate=False, only_slice=True - ) + self.obj._mgr = self.obj._mgr.reindex_axis(keys, axis=0, only_slice=True) def __setitem__(self, key, value): check_deprecated_indexers(key) diff --git a/pandas/core/internals/array_manager.py b/pandas/core/internals/array_manager.py index 7bce3803668b0..4d36fa5f77b15 100644 --- a/pandas/core/internals/array_manager.py +++ b/pandas/core/internals/array_manager.py @@ -545,7 +545,6 @@ def reindex_indexer( allow_dups: bool = False, copy: bool = True, # ignored keywords - consolidate: bool = True, only_slice: bool = False, # ArrayManager specific keywords use_na_proxy: bool = False, diff --git a/pandas/core/internals/base.py b/pandas/core/internals/base.py index 74d8b20332fff..150214b149f3e 100644 --- a/pandas/core/internals/base.py +++ b/pandas/core/internals/base.py @@ -74,7 +74,6 @@ def reindex_indexer( fill_value=None, allow_dups: bool = False, copy: bool = True, - consolidate: bool = True, only_slice: bool = False, ) -> T: raise AbstractMethodError(self) @@ -85,7 +84,6 @@ def reindex_axis( new_index: Index, axis: int, fill_value=None, - consolidate: bool = True, only_slice: bool = False, ) -> T: """ @@ -99,7 +97,6 @@ def reindex_axis( axis=axis, fill_value=fill_value, copy=False, - consolidate=consolidate, only_slice=only_slice, ) diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index da9df1b4f30df..ff185a8f1949d 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -404,7 +404,6 @@ def shift(self: T, periods: int, axis: int, fill_value) -> T: axis=0, fill_value=fill_value, allow_dups=True, - consolidate=False, ) return result @@ -639,7 +638,6 @@ def reindex_indexer( fill_value=None, allow_dups: bool = False, copy: bool = True, - consolidate: bool = True, only_slice: bool = False, *, use_na_proxy: bool = False, @@ -653,8 +651,6 @@ def reindex_indexer( fill_value : object, default None allow_dups : bool, default False copy : bool, default True - consolidate: bool, default True - Whether to consolidate inplace before reindexing. only_slice : bool, default False Whether to take views, not copies, along columns. use_na_proxy : bool, default False @@ -899,7 +895,6 @@ def take(self: T, indexer, axis: int = 1, verify: bool = True) -> T: indexer=indexer, axis=axis, allow_dups=True, - consolidate=False, )