Skip to content

Commit 06d1dc7

Browse files
Marco GorelliMarcoGorelli
Marco Gorelli
authored andcommitted
Rephrase whatsnew entry, name copy of self result rather than frame
1 parent efd5463 commit 06d1dc7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/source/whatsnew/v1.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Indexing
143143
^^^^^^^^
144144

145145
- Bug in assignment using a reverse slicer (:issue:`26939`)
146-
- Frame gets duplicated when exploding a single column and there are duplicates in the index (:issue:`28010`)
146+
- Bug in :meth:`DataFrame.explode` would duplicate frame in the presence of duplicates in the index (:issue:`28010`)
147147

148148
Missing
149149
^^^^^^^

pandas/core/frame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6259,9 +6259,9 @@ def explode(self, column: Union[str, Tuple]) -> "DataFrame":
62596259
if not self.columns.is_unique:
62606260
raise ValueError("columns must be unique")
62616261

6262-
frame = self.copy()
6263-
exploded_col = frame.pop(column).reset_index(drop=True).explode()
6264-
result = frame.reset_index().join(exploded_col)
6262+
result = self.copy()
6263+
exploded_col = result.pop(column).reset_index(drop=True).explode()
6264+
result = result.reset_index().join(exploded_col)
62656265

62666266
if isinstance(self.index, ABCMultiIndex):
62676267
result.index = pandas.MultiIndex.from_frame(

0 commit comments

Comments
 (0)