Skip to content
Merged
Changes from all 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
11 changes: 10 additions & 1 deletion pandas/tests/test_multilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
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 +487,14 @@ def test_xs_partial(self):
expected = df.loc['foo', 'one']
tm.assert_frame_equal(result, expected)

def test_xs_with_duplicates(self):
# Issue #13719
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