File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -840,7 +840,7 @@ def __contains__(self, key):
840
840
try :
841
841
self .get_loc (key )
842
842
return True
843
- except (LookupError , TypeError ):
843
+ except (LookupError , TypeError , ValueError ):
844
844
return False
845
845
846
846
contains = __contains__
Original file line number Diff line number Diff line change @@ -1711,6 +1711,14 @@ def test_repeat(self):
1711
1711
m_df = Series (data , index = m_idx )
1712
1712
assert m_df .repeat (3 ).shape == (3 * len (data ), )
1713
1713
1714
+ def test_in (self ):
1715
+ # GH 24570
1716
+ tx = pd .timedelta_range ('09:30:00' , '16:00:00' , freq = '30 min' )
1717
+ idx = MultiIndex .from_arrays ([tx , np .arange (len (tx ))])
1718
+ assert tx [0 ] in idx
1719
+ assert 'element_not_exit' not in idx
1720
+ assert '0 day 09:30:00' in idx
1721
+
1714
1722
1715
1723
class TestSorted (Base ):
1716
1724
""" everything you wanted to test about sorting """
You can’t perform that action at this time.
0 commit comments