Skip to content

Commit c766009

Browse files
committed
test for subset of a MultiIndex dtype
1 parent 0de9955 commit c766009

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/test_multilevel.py

+8
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,14 @@ def test_repeat(self):
19321932
m_df = Series(data, index=m_idx)
19331933
assert m_df.repeat(3).shape == (3 * len(data),)
19341934

1935+
def test_subsets_multiindex_dtype(self):
1936+
# GH 20757
1937+
cols = [(1, 2), (3, 4), (5, 6), (7, 8)]
1938+
data = ["a", "b", "c", "d"]
1939+
result = pd.DataFrame(data, columns=MultiIndex.from_tuples(cols)).dtypes.a.d.i
1940+
expected = pd.DataFrame(data, columns=MultiIndex.from_tuples(cols)).a.d.i.dtypes
1941+
tm.assert_frame_equal(result, expected)
1942+
19351943

19361944
class TestSorted(Base):
19371945
""" everything you wanted to test about sorting """

0 commit comments

Comments
 (0)