@@ -2699,6 +2699,7 @@ def _partial_tup_index(self, tup: tuple, side: Literal["left", "right"] = "left"
2699
2699
for k , (lab , lev , level_codes ) in enumerate (zipped ):
2700
2700
section = level_codes [start :end ]
2701
2701
2702
+ loc : npt .NDArray [np .intp ] | np .intp | int
2702
2703
if lab not in lev and not isna (lab ):
2703
2704
# short circuit
2704
2705
try :
@@ -2710,10 +2711,7 @@ def _partial_tup_index(self, tup: tuple, side: Literal["left", "right"] = "left"
2710
2711
# non-comparable level, e.g. test_groupby_example
2711
2712
raise TypeError (f"Level type mismatch: { lab } " )
2712
2713
if side == "right" and loc >= 0 :
2713
- # error: Incompatible types in assignment (expression has type
2714
- # "Union[int, Any]", variable has type "Union[ndarray[Any,
2715
- # dtype[signedinteger[Any]]], signedinteger[Any]]")
2716
- loc -= 1 # type: ignore[assignment]
2714
+ loc -= 1
2717
2715
return start + algos .searchsorted (section , loc , side = side )
2718
2716
2719
2717
idx = self ._get_loc_single_level_index (lev , lab )
@@ -2933,8 +2931,8 @@ def get_loc_level(self, key, level: IndexLabel = 0, drop_level: bool = True):
2933
2931
loc , mi = self ._get_loc_level (key , level = level )
2934
2932
if not drop_level :
2935
2933
if lib .is_integer (loc ):
2936
- # error: Slice index must be an integer or None
2937
- mi = self [loc : loc + 1 ] # type: ignore[misc]
2934
+ loc = cast ( int , loc )
2935
+ mi = self [loc : loc + 1 ]
2938
2936
else :
2939
2937
mi = self [loc ]
2940
2938
return loc , mi
0 commit comments