Skip to content

Commit e799c42

Browse files
author
Marco Gorelli
committed
Simplify renaming index
1 parent e27434d commit e799c42

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pandas/core/frame.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -6255,13 +6255,9 @@ def explode(self, column: Union[str, Tuple]) -> "DataFrame":
62556255
result.index = pandas.MultiIndex.from_frame(
62566256
result.iloc[:, : self.index.nlevels]
62576257
)
6258-
result.index.rename(
6259-
[i or None for num, i in enumerate(self.index.names)], inplace=True
6260-
)
62616258
else:
62626259
result.index = result.iloc[:, 0]
6263-
result.index.rename(self.index.name or None, inplace=True)
6264-
6260+
result.index.names = self.index.names
62656261
result = result.reindex(columns=self.columns, copy=False)
62666262

62676263
return result

0 commit comments

Comments
 (0)