From 94412eebd218b346ec4db0453f4cc8c31f10233d Mon Sep 17 00:00:00 2001 From: ganevgv Date: Sun, 17 Nov 2019 00:06:09 +0200 Subject: [PATCH] TST: new test for subset of a MultiIndex dtype (#29356) --- pandas/tests/test_multilevel.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index 4d0f0b57c65af..f0928820367e9 100644 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -1989,6 +1989,15 @@ def test_repeat(self): m_df = Series(data, index=m_idx) assert m_df.repeat(3).shape == (3 * len(data),) + def test_subsets_multiindex_dtype(self): + # GH 20757 + data = [["x", 1]] + columns = [("a", "b", np.nan), ("a", "c", 0.0)] + df = DataFrame(data, columns=pd.MultiIndex.from_tuples(columns)) + expected = df.dtypes.a.b + result = df.a.b.dtypes + tm.assert_series_equal(result, expected) + class TestSorted(Base): """ everything you wanted to test about sorting """