Skip to content

Commit

Permalink
CLN: values is required argument in _shallow_copy_with_infer (#22983)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche authored and TomAugspurger committed Oct 4, 2018
1 parent c282e31 commit 9b405b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,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:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9b405b8

Please sign in to comment.