@@ -457,11 +457,8 @@ def __contains__(self, key):
457
457
try :
458
458
self .get_loc (key )
459
459
return True
460
- except (ValueError , TypeError , KeyError ):
460
+ except (TypeError , KeyError ):
461
461
# TypeError can be reached if we pass a tuple that is not hashable
462
- # ValueError can be reached if pass a 2-tuple and parse_time_string
463
- # raises with the wrong number of return values
464
- # TODO: the latter is a bug in parse_time_string
465
462
return False
466
463
467
464
@cache_readonly
@@ -608,7 +605,7 @@ def get_value(self, series, key):
608
605
try :
609
606
return com .maybe_box (self , super ().get_value (s , key ), series , key )
610
607
except (KeyError , IndexError ):
611
- try :
608
+ if isinstance ( key , str ) :
612
609
asdt , parsed , reso = parse_time_string (key , self .freq )
613
610
grp = resolution .Resolution .get_freq_group (reso )
614
611
freqn = resolution .get_freq_group (self .freq )
@@ -634,8 +631,6 @@ def get_value(self, series, key):
634
631
)
635
632
else :
636
633
raise KeyError (key )
637
- except TypeError :
638
- pass
639
634
640
635
period = Period (key , self .freq )
641
636
key = period .value if isna (period ) else period .ordinal
0 commit comments