@@ -1429,6 +1429,27 @@ def test_drop(self):
1429
1429
expected = Index ([1 , 2 ])
1430
1430
tm .assert_index_equal (dropped , expected )
1431
1431
1432
+ @pytest .mark .parametrize ("values" , [['a' , 'b' , ('c' , 'd' )],
1433
+ ['a' , ('c' , 'd' ), 'b' ],
1434
+ [('c' , 'd' ), 'a' , 'b' ]])
1435
+ @pytest .mark .parametrize ("to_drop" , [[('c' , 'd' ), 'a' ], ['a' , ('c' , 'd' )]])
1436
+ def test_drop_tuple (self , values , to_drop ):
1437
+ # GH 18304
1438
+ index = pd .Index (values )
1439
+ expected = pd .Index (['b' ])
1440
+
1441
+ result = index .drop (to_drop )
1442
+ tm .assert_index_equal (result , expected )
1443
+
1444
+ removed = index .drop (to_drop [0 ])
1445
+ for drop_me in to_drop [1 ], [to_drop [1 ]]:
1446
+ result = removed .drop (drop_me )
1447
+ tm .assert_index_equal (result , expected )
1448
+
1449
+ removed = index .drop (to_drop [1 ])
1450
+ for drop_me in to_drop [1 ], [to_drop [1 ]]:
1451
+ pytest .raises (ValueError , removed .drop , drop_me )
1452
+
1432
1453
def test_tuple_union_bug (self ):
1433
1454
import pandas
1434
1455
import numpy as np
0 commit comments