Skip to content

Commit ae0d20d

Browse files
author
Nicholas Musolino
committed
TST: Add test of DataFrame.xs() with duplicates (pandas-dev#13719)
1 parent 114f415 commit ae0d20d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/tests/test_multilevel.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import numpy as np
1111

1212
from pandas.core.index import Index, MultiIndex
13-
from pandas import Panel, DataFrame, Series, notna, isna, Timestamp
13+
from pandas import Panel, DataFrame, Series, notna, isna, Timestamp, concat
1414

1515
from pandas.core.dtypes.common import is_float_dtype, is_integer_dtype
1616
import pandas.core.common as com
@@ -486,6 +486,12 @@ def test_xs_partial(self):
486486
expected = df.loc['foo', 'one']
487487
tm.assert_frame_equal(result, expected)
488488

489+
# DataFrame with a MultiIndex containing (#13719)
490+
df = concat([self.frame, self.frame])
491+
result = df.xs('one', level='second')
492+
tm.assert_frame_equal(result, concat([self.frame.xs('one', level='second'),
493+
self.frame.xs('one', level='second')]))
494+
489495
def test_xs_level(self):
490496
result = self.frame.xs('two', level='second')
491497
expected = self.frame[self.frame.index.get_level_values(1) == 'two']

0 commit comments

Comments
 (0)