Skip to content

Commit 13bf395

Browse files
committed
Fixed #38419 - BUG: set_index screws up the dtypes on empty DataFrames
1 parent 0912f05 commit 13bf395

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/tests/frame/methods/test_set_index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def test_set_index_empty_dataframe(self):
5353
{"a": Series(dtype="datetime64[ns]"), "b": Series(dtype="int64"), "c": []}
5454
)
5555

56-
expected = df.set_index(["a", "b"]).reset_index()
57-
tm.assert_frame_equal(df.reset_index(drop = True),expected)
56+
expected = df.set_index(["a", "b"])
57+
tm.assert_frame_equal(df.reset_index(drop = True), expected.reset_index())
5858
assert df.empty is True
59-
59+
6060
def test_set_index_multiindexcolumns(self):
6161
columns = MultiIndex.from_tuples([("foo", 1), ("foo", 2), ("bar", 1)])
6262
df = DataFrame(np.random.randn(3, 3), columns=columns)

0 commit comments

Comments
 (0)