Skip to content

Commit

Permalink
fix issue pandas-dev#4160, rename the MultiIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingkuo committed Aug 5, 2013
1 parent fcaf9a6 commit 3c69575
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ def rename_axis(self, mapper, axis=1):

index = self.axes[axis]
if isinstance(index, MultiIndex):
new_axis = MultiIndex.from_tuples([tuple(mapper(y) for y in x) for x in index], names=index.names)
new_axis = MultiIndex.from_tuples([mapper(x) for x in index], names=index.names)
else:
new_axis = Index([mapper(x) for x in index], name=index.name)

Expand All @@ -2161,7 +2161,7 @@ def rename_axis(self, mapper, axis=1):

def rename_items(self, mapper, copydata=True):
if isinstance(self.items, MultiIndex):
items = [tuple(mapper(y) for y in x) for x in self.items]
items = [mapper(x) for x in self.items]
new_items = MultiIndex.from_tuples(items, names=self.items.names)
else:
items = [mapper(x) for x in self.items]
Expand Down

0 comments on commit 3c69575

Please sign in to comment.