Skip to content

Commit 7704c13

Browse files
committed
test for mixed level is_monotonic
1 parent 7469276 commit 7704c13

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/indexes/test_multi.py

+10
Original file line numberDiff line numberDiff line change
@@ -2391,6 +2391,16 @@ def test_is_monotonic(self):
23912391
self.assertTrue(i.is_monotonic)
23922392
self.assertTrue(Index(i.values).is_monotonic)
23932393

2394+
# mixed levels, hits the TypeError
2395+
i = MultiIndex(
2396+
levels=[[1, 2, 3, 4], ['gb00b03mlx29', 'lu0197800237',
2397+
'nl0000289783',
2398+
'nl0000289965', 'nl0000301109']],
2399+
labels=[[0, 1, 1, 2, 2, 2, 3], [4, 2, 0, 0, 1, 3, -1]],
2400+
names=['household_id', 'asset_id'])
2401+
2402+
self.assertFalse(i.is_monotonic)
2403+
23942404
def test_isin(self):
23952405
values = [('foo', 2), ('bar', 3), ('quux', 4)]
23962406

0 commit comments

Comments
 (0)