Skip to content

Commit 0b86a55

Browse files
Marco GorelliMarcoGorelli
Marco Gorelli
authored andcommitted
Simplify renaming index
1 parent 52ba53b commit 0b86a55

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6270,13 +6270,9 @@ def explode(self, column: Union[str, Tuple]) -> "DataFrame":
62706270
result.index = pandas.MultiIndex.from_frame(
62716271
result.iloc[:, : self.index.nlevels]
62726272
)
6273-
result.index.rename(
6274-
[i or None for num, i in enumerate(self.index.names)], inplace=True
6275-
)
62766273
else:
62776274
result.index = result.iloc[:, 0]
6278-
result.index.rename(self.index.name or None, inplace=True)
6279-
6275+
result.index.names = self.index.names
62806276
result = result.reindex(columns=self.columns, copy=False)
62816277

62826278
return result

0 commit comments

Comments
 (0)