Skip to content

Commit a2e58f9

Browse files
author
Santhosh18
committed
Inferred dtype at the end of df.explode()
1 parent 5cab7ae commit a2e58f9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7070,6 +7070,7 @@ def explode(
70707070
else:
70717071
result.index = self.index.take(result.index)
70727072
result = result.reindex(columns=self.columns, copy=False)
7073+
result = result.infer_objects()
70737074

70747075
return result
70757076

pandas/tests/series/methods/test_explode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def test_basic():
99
s = pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd"), name="foo")
10-
result = s.explode()
10+
result = s. explode()
1111
expected = pd.Series(
1212
[0, 1, 2, np.nan, np.nan, 3, 4], index=list("aaabcdd"), dtype=object, name="foo"
1313
)

0 commit comments

Comments
 (0)