Skip to content

Commit

Permalink
TST: partial indexing with __getitem__ and integer labels
Browse files Browse the repository at this point in the history
closes #12416
  • Loading branch information
toobaz committed Apr 17, 2017
1 parent 0e2bbcf commit 37e5a00
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pandas/tests/indexing/test_multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,24 @@ def test_loc_multiindex(self):
xp = mi_int.ix[4]
tm.assert_frame_equal(rs, xp)

def test_loc_getitem_partial_int(self):
# GH 12416
# with single item
l1 = [10, 20]
l2 = ['a', 'b']
df = DataFrame(index=range(2),
columns=pd.MultiIndex.from_product([l1, l2]))
expected = DataFrame(index=range(2),
columns=l2)
result = df[20]
tm.assert_frame_equal(result, expected)

# with list
expected = DataFrame(index=range(2),
columns=pd.MultiIndex.from_product([l1[1:], l2]))
result = df[[20]]
tm.assert_frame_equal(result, expected)

def test_loc_multiindex_indexer_none(self):

# GH6788
Expand Down

0 comments on commit 37e5a00

Please sign in to comment.