Skip to content

Commit 07732d7

Browse files
authored
CLN: consolidate arg no longer needed (#45400)
1 parent adec4fe commit 07732d7

File tree

6 files changed

+4
-19
lines changed

6 files changed

+4
-19
lines changed

pandas/core/base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ def _obj_with_exclusions(self):
224224
if len(self.exclusions) > 0:
225225
# equivalent to `self.obj.drop(self.exclusions, axis=1)
226226
# but this avoids consolidating and making a copy
227-
return self.obj._drop_axis(
228-
self.exclusions, axis=1, consolidate=False, only_slice=True
229-
)
227+
# TODO: following GH#45287 can we now use .drop directly without
228+
# making a copy?
229+
return self.obj._drop_axis(self.exclusions, axis=1, only_slice=True)
230230
else:
231231
return self.obj
232232

pandas/core/generic.py

-4
Original file line numberDiff line numberDiff line change
@@ -4259,7 +4259,6 @@ def _drop_axis(
42594259
axis,
42604260
level=None,
42614261
errors: str = "raise",
4262-
consolidate: bool_t = True,
42634262
only_slice: bool_t = False,
42644263
) -> NDFrameT:
42654264
"""
@@ -4274,8 +4273,6 @@ def _drop_axis(
42744273
For MultiIndex
42754274
errors : {'ignore', 'raise'}, default 'raise'
42764275
If 'ignore', suppress error and existing labels are dropped.
4277-
consolidate : bool, default True
4278-
Whether to call consolidate_inplace in the reindex_indexer call.
42794276
only_slice : bool, default False
42804277
Whether indexing along columns should be view-only.
42814278
@@ -4329,7 +4326,6 @@ def _drop_axis(
43294326
indexer,
43304327
axis=bm_axis,
43314328
allow_dups=True,
4332-
consolidate=consolidate,
43334329
only_slice=only_slice,
43344330
)
43354331
result = self._constructor(new_mgr)

pandas/core/indexing.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,7 @@ def _ensure_listlike_indexer(self, key, axis=None, value=None):
714714
# GH#38148
715715
keys = self.obj.columns.union(key, sort=False)
716716

717-
self.obj._mgr = self.obj._mgr.reindex_axis(
718-
keys, axis=0, consolidate=False, only_slice=True
719-
)
717+
self.obj._mgr = self.obj._mgr.reindex_axis(keys, axis=0, only_slice=True)
720718

721719
@final
722720
def __setitem__(self, key, value):

pandas/core/internals/array_manager.py

-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ def reindex_indexer(
545545
allow_dups: bool = False,
546546
copy: bool = True,
547547
# ignored keywords
548-
consolidate: bool = True,
549548
only_slice: bool = False,
550549
# ArrayManager specific keywords
551550
use_na_proxy: bool = False,

pandas/core/internals/base.py

-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def reindex_indexer(
7474
fill_value=None,
7575
allow_dups: bool = False,
7676
copy: bool = True,
77-
consolidate: bool = True,
7877
only_slice: bool = False,
7978
) -> T:
8079
raise AbstractMethodError(self)
@@ -85,7 +84,6 @@ def reindex_axis(
8584
new_index: Index,
8685
axis: int,
8786
fill_value=None,
88-
consolidate: bool = True,
8987
only_slice: bool = False,
9088
) -> T:
9189
"""
@@ -99,7 +97,6 @@ def reindex_axis(
9997
axis=axis,
10098
fill_value=fill_value,
10199
copy=False,
102-
consolidate=consolidate,
103100
only_slice=only_slice,
104101
)
105102

pandas/core/internals/managers.py

-5
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ def shift(self: T, periods: int, axis: int, fill_value) -> T:
404404
axis=0,
405405
fill_value=fill_value,
406406
allow_dups=True,
407-
consolidate=False,
408407
)
409408
return result
410409

@@ -639,7 +638,6 @@ def reindex_indexer(
639638
fill_value=None,
640639
allow_dups: bool = False,
641640
copy: bool = True,
642-
consolidate: bool = True,
643641
only_slice: bool = False,
644642
*,
645643
use_na_proxy: bool = False,
@@ -653,8 +651,6 @@ def reindex_indexer(
653651
fill_value : object, default None
654652
allow_dups : bool, default False
655653
copy : bool, default True
656-
consolidate: bool, default True
657-
Whether to consolidate inplace before reindexing.
658654
only_slice : bool, default False
659655
Whether to take views, not copies, along columns.
660656
use_na_proxy : bool, default False
@@ -899,7 +895,6 @@ def take(self: T, indexer, axis: int = 1, verify: bool = True) -> T:
899895
indexer=indexer,
900896
axis=axis,
901897
allow_dups=True,
902-
consolidate=False,
903898
)
904899

905900

0 commit comments

Comments
 (0)