@@ -32,6 +32,7 @@ import numpy as np
3232from pandas .core .arrays .boolean import BooleanArray
3333from pandas .core .arrays .floating import FloatingArray
3434from pandas .core .base import (
35+ T_INTERVAL_NP ,
3536 ArrayIndexTimedeltaNoSeq ,
3637 ElementOpsMixin ,
3738 IndexComplex ,
@@ -106,6 +107,7 @@ from pandas._typing import (
106107 PandasFloatDtypeArg ,
107108 PyArrowFloatDtypeArg ,
108109 ReindexMethod ,
110+ Renamer ,
109111 S2_contra ,
110112 Scalar ,
111113 SequenceNotStr ,
@@ -532,39 +534,59 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
532534 ) -> Index [C2 ]: ...
533535 @overload
534536 def append (self , other : Index | Sequence [Index ]) -> Index : ...
535- def putmask (self , mask , value ): ...
537+ def putmask (
538+ self ,
539+ mask : Sequence [bool ] | np_ndarray_bool | BooleanArray | IndexOpsMixin [bool ],
540+ value : Scalar ,
541+ ) -> Index : ...
536542 def equals (self , other : Any ) -> bool : ...
537543 @final
538544 def identical (self , other : Any ) -> bool : ...
539545 @final
540- def asof (self , label ): ...
541- def asof_locs (self , where , mask ): ...
546+ def asof (self , label : Scalar ) -> Scalar : ...
547+ def asof_locs (
548+ self , where : DatetimeIndex , mask : np_ndarray_bool
549+ ) -> np_1darray_intp : ...
550+ @overload
551+ def sort_values (
552+ self ,
553+ * ,
554+ return_indexer : Literal [False ] = False ,
555+ ascending : bool = True ,
556+ na_position : NaPosition = "last" ,
557+ key : Callable [[Index ], Index ] | None = None ,
558+ ) -> Self : ...
559+ @overload
542560 def sort_values (
543561 self ,
544562 * ,
545- return_indexer : bool = ... ,
546- ascending : bool = ... ,
547- na_position : NaPosition = ... ,
563+ return_indexer : Literal [ True ] ,
564+ ascending : bool = True ,
565+ na_position : NaPosition = "last" ,
548566 key : Callable [[Index ], Index ] | None = None ,
549- ): ...
567+ ) -> tuple [ Self , np_1darray_intp ] : ...
550568 @final
551569 def sort (self , * args : Any , ** kwargs : Any ) -> None : ...
552570 def argsort (self , * args : Any , ** kwargs : Any ) -> np_1darray_intp : ...
553- def get_indexer_non_unique (self , target ): ...
571+ def get_indexer_non_unique (
572+ self , target : Index
573+ ) -> tuple [np_1darray_intp , np_1darray_intp ]: ...
554574 @final
555- def get_indexer_for (self , target , ** kwargs : Any ): ...
556- def map (self , mapper , na_action = ...) -> Index : ...
575+ def get_indexer_for (self , target : Index ) -> np_1darray_intp : ...
576+ def map (
577+ self , mapper : Renamer , na_action : Literal ["ignore" ] | None = None
578+ ) -> Index : ...
557579 def isin (self , values , level = ...) -> np_1darray_bool : ...
558580 def slice_indexer (
559581 self ,
560582 start : Label | None = None ,
561583 end : Label | None = None ,
562584 step : int | None = None ,
563- ): ...
564- def get_slice_bound (self , label , side ) : ...
585+ ) -> slice : ...
586+ def get_slice_bound (self , label : Scalar , side : Literal [ "left" , "right" ]) -> int : ...
565587 def slice_locs (
566588 self , start : SliceType = None , end : SliceType = None , step : int | None = None
567- ): ...
589+ ) -> tuple [ int | np . intp , int | np . intp ] : ...
568590 def delete (
569591 self , loc : np .integer | int | AnyArrayLikeInt | Sequence [int ]
570592 ) -> Self : ...
@@ -1168,6 +1190,14 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
11681190
11691191@type_check_only
11701192class _IndexSubclassBase (Index [S1 ], Generic [S1 , GenericT_co ]):
1193+ @overload
1194+ def to_numpy (
1195+ self : _IndexSubclassBase [Interval ],
1196+ dtype : type [T_INTERVAL_NP ],
1197+ copy : bool = False ,
1198+ na_value : Scalar = ...,
1199+ ** kwargs : Any ,
1200+ ) -> np_1darray : ...
11711201 @overload
11721202 def to_numpy (
11731203 self ,
@@ -1185,7 +1215,7 @@ class _IndexSubclassBase(Index[S1], Generic[S1, GenericT_co]):
11851215 ** kwargs : Any ,
11861216 ) -> np_1darray [GenericT ]: ...
11871217 @overload
1188- def to_numpy (
1218+ def to_numpy ( # pyright: ignore[reportIncompatibleMethodOverride]
11891219 self ,
11901220 dtype : DTypeLike ,
11911221 copy : bool = False ,
0 commit comments