@@ -215,7 +215,7 @@ def join(
215215 return cast (F , join )
216216
217217
218- def disallow_kwargs (kwargs : dict [str , Any ]):
218+ def disallow_kwargs (kwargs : dict [str , Any ]) -> None :
219219 if kwargs :
220220 raise TypeError (f"Unexpected keyword arguments { repr (set (kwargs ))} " )
221221
@@ -626,7 +626,7 @@ def _maybe_check_unique(self) -> None:
626626 raise DuplicateLabelError (msg )
627627
628628 @final
629- def _format_duplicate_message (self ):
629+ def _format_duplicate_message (self ) -> DataFrame :
630630 """
631631 Construct the DataFrame for a DuplicateLabelError.
632632
@@ -789,7 +789,7 @@ def __array_wrap__(self, result, context=None):
789789 return Index (result , ** attrs )
790790
791791 @cache_readonly
792- def dtype (self ):
792+ def dtype (self ) -> DtypeObj :
793793 """
794794 Return the dtype object of the underlying data.
795795 """
@@ -1064,11 +1064,11 @@ def copy(
10641064 return new_index
10651065
10661066 @final
1067- def __copy__ (self , ** kwargs ):
1067+ def __copy__ (self : _IndexT , ** kwargs ) -> _IndexT :
10681068 return self .copy (** kwargs )
10691069
10701070 @final
1071- def __deepcopy__ (self , memo = None ):
1071+ def __deepcopy__ (self : _IndexT , memo = None ) -> _IndexT :
10721072 """
10731073 Parameters
10741074 ----------
@@ -1354,7 +1354,7 @@ def to_series(self, index=None, name: Hashable = None) -> Series:
13541354
13551355 return Series (self ._values .copy (), index = index , name = name )
13561356
1357- def to_frame (self , index : bool = True , name = None ) -> DataFrame :
1357+ def to_frame (self , index : bool = True , name : Hashable = None ) -> DataFrame :
13581358 """
13591359 Create a DataFrame with a column containing the Index.
13601360
@@ -1426,7 +1426,7 @@ def name(self):
14261426 return self ._name
14271427
14281428 @name .setter
1429- def name (self , value ):
1429+ def name (self , value : Hashable ):
14301430 if self ._no_setting_name :
14311431 # Used in MultiIndex.levels to avoid silently ignoring name updates.
14321432 raise RuntimeError (
@@ -2367,7 +2367,7 @@ def _is_all_dates(self) -> bool:
23672367
23682368 @cache_readonly
23692369 @final
2370- def is_all_dates (self ):
2370+ def is_all_dates (self ) -> bool :
23712371 """
23722372 Whether or not the index values only consist of dates.
23732373 """
@@ -3380,7 +3380,7 @@ def get_loc(self, key, method=None, tolerance=None):
33803380
33813381 Returns
33823382 -------
3383- indexer : ndarray of int
3383+ indexer : np. ndarray[np.intp]
33843384 Integers from 0 to n - 1 indicating that the index at these
33853385 positions matches the corresponding target values. Missing values
33863386 in the target are marked by -1.
@@ -4610,7 +4610,7 @@ def _can_hold_identifiers_and_holds_name(self, name) -> bool:
46104610 return name in self
46114611 return False
46124612
4613- def append (self , other ) -> Index :
4613+ def append (self , other : Index | Sequence [ Index ] ) -> Index :
46144614 """
46154615 Append a collection of Index options together.
46164616
@@ -4627,7 +4627,9 @@ def append(self, other) -> Index:
46274627 if isinstance (other , (list , tuple )):
46284628 to_concat += list (other )
46294629 else :
4630- to_concat .append (other )
4630+ # error: Argument 1 to "append" of "list" has incompatible type
4631+ # "Union[Index, Sequence[Index]]"; expected "Index"
4632+ to_concat .append (other ) # type: ignore[arg-type]
46314633
46324634 for obj in to_concat :
46334635 if not isinstance (obj , Index ):
@@ -5181,11 +5183,11 @@ def set_value(self, arr, key, value):
51815183
51825184 Returns
51835185 -------
5184- indexer : ndarray of int
5186+ indexer : np. ndarray[np.intp]
51855187 Integers from 0 to n - 1 indicating that the index at these
51865188 positions matches the corresponding target values. Missing values
51875189 in the target are marked by -1.
5188- missing : ndarray of int
5190+ missing : np. ndarray[np.intp]
51895191 An indexer into the target of the values not found.
51905192 These correspond to the -1 in the indexer array.
51915193 """
@@ -5227,7 +5229,7 @@ def get_indexer_for(self, target, **kwargs) -> np.ndarray:
52275229
52285230 Returns
52295231 -------
5230- numpy .ndarray
5232+ np .ndarray[np.intp]
52315233 List of indices.
52325234 """
52335235 if self ._index_as_unique :
0 commit comments