(self)
| 382 | tm.assert_frame_equal(result, expected) |
| 383 | |
| 384 | def test_ignore_multiindex(self): |
| 385 | # GH 17440 |
| 386 | index = pd.MultiIndex.from_tuples( |
| 387 | [("first", "second"), ("first", "third")], names=["baz", "foobar"] |
| 388 | ) |
| 389 | df = DataFrame({"foo": [0, 1], "bar": [2, 3]}, index=index) |
| 390 | result = melt(df, ignore_index=False) |
| 391 | |
| 392 | expected_index = pd.MultiIndex.from_tuples( |
| 393 | [("first", "second"), ("first", "third")] * 2, names=["baz", "foobar"] |
| 394 | ) |
| 395 | expected = DataFrame( |
| 396 | {"variable": ["foo"] * 2 + ["bar"] * 2, "value": [0, 1, 2, 3]}, |
| 397 | index=expected_index, |
| 398 | ) |
| 399 | |
| 400 | tm.assert_frame_equal(result, expected) |
| 401 | |
| 402 | def test_ignore_index_name_and_type(self): |
| 403 | # GH 17440 |
nothing calls this directly
no test coverage detected