@@ -14,7 +14,6 @@ from pathlib import Path
1414from typing import (
1515 Any ,
1616 ClassVar ,
17- Generic ,
1817 Literal ,
1918 final ,
2019 overload ,
@@ -67,6 +66,7 @@ from pandas._typing import (
6766 S2 ,
6867 S2_NSDT ,
6968 T_COMPLEX ,
69+ A1_co ,
7070 AnyAll ,
7171 AnyArrayLike ,
7272 AnyArrayLikeInt ,
@@ -109,7 +109,7 @@ from pandas._typing import (
109109
110110class InvalidIndexError (Exception ): ...
111111
112- class Index (IndexOpsMixin [S1 ], ElementOpsMixin [S1 ]):
112+ class Index (IndexOpsMixin [S1 , A1_co , GenericT_co ], ElementOpsMixin [S1 ]):
113113 __hash__ : ClassVar [None ] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
114114 # overloads with additional dtypes
115115 @overload
@@ -475,15 +475,19 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
475475 @overload
476476 def where (
477477 self ,
478- cond : Sequence [bool ] | np_ndarray_bool | BooleanArray | IndexOpsMixin [bool ],
479- other : S1 | Series [S1 ] | Self ,
478+ cond : (
479+ Sequence [bool ] | np_ndarray_bool | BooleanArray | IndexOpsMixin [bool , A1_co ]
480+ ),
481+ other : S1 | Series [S1 , A1_co ] | Self ,
480482 ) -> Self : ...
481483 @overload
482484 def where (
483485 self ,
484- cond : Sequence [bool ] | np_ndarray_bool | BooleanArray | IndexOpsMixin [bool ],
486+ cond : (
487+ Sequence [bool ] | np_ndarray_bool | BooleanArray | IndexOpsMixin [bool , A1_co ]
488+ ),
485489 other : Scalar | AnyArrayLike | None = None ,
486- ) -> Index : ...
490+ ) -> Index [ Any , A1_co ] : ...
487491 def __contains__ (self , key : Hashable ) -> bool : ...
488492 @final
489493 def __setitem__ (self , key , value ) -> None : ...
@@ -541,7 +545,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
541545 @overload
542546 def insert (self , loc : int , item : S1 ) -> Self : ...
543547 @overload
544- def insert (self , loc : int , item : object ) -> Index : ...
548+ def insert (self , loc : int , item : Any ) -> Index [ Any , A1_co ] : ...
545549 def drop (self , labels , errors : IgnoreRaise = "raise" ) -> Self : ...
546550 @property
547551 def shape (self ) -> tuple [int , ...]: ...
@@ -731,7 +735,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
731735 ),
732736 ) -> Index [complex ]: ...
733737 @overload
734- def __rsub__ (self : Index [Never ], other : DatetimeIndex ) -> Never : ... # type: ignore[misc]
738+ def __rsub__ (self : Index [Never ], other : DatetimeIndex ) -> Never : ...
735739 @overload
736740 def __rsub__ (
737741 self : Index [Never ], other : complex | ArrayLike | SequenceNotStr [S1 ] | Index
@@ -1051,7 +1055,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
10511055 def infer_objects (self , copy : bool = True ) -> Self : ...
10521056
10531057@type_check_only
1054- class _IndexSubclassBase (Index [S1 ], Generic [ S1 , GenericT_co ]):
1058+ class _IndexSubclassBase (Index [S1 , A1_co , GenericT_co ]):
10551059 @overload
10561060 def to_numpy (
10571061 self ,
0 commit comments