Skip to content

Commit 9b405b8

Browse files
jorisvandenbosscheTomAugspurger
authored andcommitted
CLN: values is required argument in _shallow_copy_with_infer (pandas-dev#22983)
1 parent c282e31 commit 9b405b8

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

pandas/core/indexes/base.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def _shallow_copy(self, values=None, **kwargs):
530530

531531
return self._simple_new(values, **attributes)
532532

533-
def _shallow_copy_with_infer(self, values=None, **kwargs):
533+
def _shallow_copy_with_infer(self, values, **kwargs):
534534
"""
535535
create a new Index inferring the class with passed value, don't copy
536536
the data, use the same object attributes with passed in attributes
@@ -543,8 +543,6 @@ def _shallow_copy_with_infer(self, values=None, **kwargs):
543543
values : the values to create the new Index, optional
544544
kwargs : updates the default attributes for this Index
545545
"""
546-
if values is None:
547-
values = self.values
548546
attributes = self._get_attributes_dict()
549547
attributes.update(kwargs)
550548
attributes['copy'] = False

pandas/core/indexes/multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def view(self, cls=None):
556556
result._id = self._id
557557
return result
558558

559-
def _shallow_copy_with_infer(self, values=None, **kwargs):
559+
def _shallow_copy_with_infer(self, values, **kwargs):
560560
# On equal MultiIndexes the difference is empty.
561561
# Therefore, an empty MultiIndex is returned GH13490
562562
if len(values) == 0:

pandas/core/indexes/period.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def _from_ordinals(cls, values, name=None, freq=None, **kwargs):
287287
result._reset_identity()
288288
return result
289289

290-
def _shallow_copy_with_infer(self, values=None, **kwargs):
290+
def _shallow_copy_with_infer(self, values, **kwargs):
291291
""" we always want to return a PeriodIndex """
292292
return self._shallow_copy(values=values, **kwargs)
293293

0 commit comments

Comments
 (0)