Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pandas/tests/test_multilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np

from pandas.core.index import Index, MultiIndex
from pandas import Panel, DataFrame, Series, notna, isna, Timestamp, read_csv
from pandas import Panel, DataFrame, Series, notna, isna, Timestamp, concat, read_csv

from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype
import pandas.core.common as com
Expand Down Expand Up @@ -486,6 +486,13 @@ def test_xs_partial(self):
expected = df.loc['foo', 'one']
tm.assert_frame_equal(result, expected)

# DataFrame with a MultiIndex containing duplicates (#13719)
Copy link
Contributor

@jreback jreback Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add as a separate test.

df_dup = concat([self.frame] * 2)
assert not df_dup.index.is_unique
expected = concat([self.frame.xs('one', level='second')] * 2)
tm.assert_frame_equal(df_dup.xs('one', level='second'), expected)
tm.assert_frame_equal(df_dup.xs(['one'], level=['second']), expected)

def test_xs_level(self):
result = self.frame.xs('two', level='second')
expected = self.frame[self.frame.index.get_level_values(1) == 'two']
Expand Down