diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index af04a846ed787..51c84d6e28cb4 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -530,7 +530,7 @@ def _shallow_copy(self, values=None, **kwargs): return self._simple_new(values, **attributes) - def _shallow_copy_with_infer(self, values=None, **kwargs): + def _shallow_copy_with_infer(self, values, **kwargs): """ create a new Index inferring the class with passed value, don't copy the data, use the same object attributes with passed in attributes @@ -543,8 +543,6 @@ def _shallow_copy_with_infer(self, values=None, **kwargs): values : the values to create the new Index, optional kwargs : updates the default attributes for this Index """ - if values is None: - values = self.values attributes = self._get_attributes_dict() attributes.update(kwargs) attributes['copy'] = False diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 3e6b934e1e863..822c0b864059c 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -555,7 +555,7 @@ def view(self, cls=None): result._id = self._id return result - def _shallow_copy_with_infer(self, values=None, **kwargs): + def _shallow_copy_with_infer(self, values, **kwargs): # On equal MultiIndexes the difference is empty. # Therefore, an empty MultiIndex is returned GH13490 if len(values) == 0: diff --git a/pandas/core/indexes/period.py b/pandas/core/indexes/period.py index 969391569ce50..cc008694a8b84 100644 --- a/pandas/core/indexes/period.py +++ b/pandas/core/indexes/period.py @@ -287,7 +287,7 @@ def _from_ordinals(cls, values, name=None, freq=None, **kwargs): result._reset_identity() return result - def _shallow_copy_with_infer(self, values=None, **kwargs): + def _shallow_copy_with_infer(self, values, **kwargs): """ we always want to return a PeriodIndex """ return self._shallow_copy(values=values, **kwargs)