Skip to content

Commit 566a7d2

Browse files
author
Marco Gorelli
committed
Simplify renaming index
1 parent e4303bd commit 566a7d2

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
@@ -6254,13 +6254,9 @@ def explode(self, column: Union[str, Tuple]) -> "DataFrame":
62546254
result.index = pandas.MultiIndex.from_frame(
62556255
result.iloc[:, : self.index.nlevels]
62566256
)
6257-
result.index.rename(
6258-
[i or None for num, i in enumerate(self.index.names)], inplace=True
6259-
)
62606257
else:
62616258
result.index = result.iloc[:, 0]
6262-
result.index.rename(self.index.name or None, inplace=True)
6263-
6259+
result.index.names = self.index.names
62646260
result = result.reindex(columns=self.columns, copy=False)
62656261

62666262
return result

0 commit comments

Comments
 (0)