@@ -215,7 +215,7 @@ def join(
215
215
return cast (F , join )
216
216
217
217
218
- def disallow_kwargs (kwargs : dict [str , Any ]):
218
+ def disallow_kwargs (kwargs : dict [str , Any ]) -> None :
219
219
if kwargs :
220
220
raise TypeError (f"Unexpected keyword arguments { repr (set (kwargs ))} " )
221
221
@@ -626,7 +626,7 @@ def _maybe_check_unique(self) -> None:
626
626
raise DuplicateLabelError (msg )
627
627
628
628
@final
629
- def _format_duplicate_message (self ):
629
+ def _format_duplicate_message (self ) -> DataFrame :
630
630
"""
631
631
Construct the DataFrame for a DuplicateLabelError.
632
632
@@ -789,7 +789,7 @@ def __array_wrap__(self, result, context=None):
789
789
return Index (result , ** attrs )
790
790
791
791
@cache_readonly
792
- def dtype (self ):
792
+ def dtype (self ) -> DtypeObj :
793
793
"""
794
794
Return the dtype object of the underlying data.
795
795
"""
@@ -1064,11 +1064,11 @@ def copy(
1064
1064
return new_index
1065
1065
1066
1066
@final
1067
- def __copy__ (self , ** kwargs ):
1067
+ def __copy__ (self : _IndexT , ** kwargs ) -> _IndexT :
1068
1068
return self .copy (** kwargs )
1069
1069
1070
1070
@final
1071
- def __deepcopy__ (self , memo = None ):
1071
+ def __deepcopy__ (self : _IndexT , memo = None ) -> _IndexT :
1072
1072
"""
1073
1073
Parameters
1074
1074
----------
@@ -1354,7 +1354,7 @@ def to_series(self, index=None, name: Hashable = None) -> Series:
1354
1354
1355
1355
return Series (self ._values .copy (), index = index , name = name )
1356
1356
1357
- def to_frame (self , index : bool = True , name = None ) -> DataFrame :
1357
+ def to_frame (self , index : bool = True , name : Hashable = None ) -> DataFrame :
1358
1358
"""
1359
1359
Create a DataFrame with a column containing the Index.
1360
1360
@@ -1426,7 +1426,7 @@ def name(self):
1426
1426
return self ._name
1427
1427
1428
1428
@name .setter
1429
- def name (self , value ):
1429
+ def name (self , value : Hashable ):
1430
1430
if self ._no_setting_name :
1431
1431
# Used in MultiIndex.levels to avoid silently ignoring name updates.
1432
1432
raise RuntimeError (
@@ -2367,7 +2367,7 @@ def _is_all_dates(self) -> bool:
2367
2367
2368
2368
@cache_readonly
2369
2369
@final
2370
- def is_all_dates (self ):
2370
+ def is_all_dates (self ) -> bool :
2371
2371
"""
2372
2372
Whether or not the index values only consist of dates.
2373
2373
"""
@@ -3380,7 +3380,7 @@ def get_loc(self, key, method=None, tolerance=None):
3380
3380
3381
3381
Returns
3382
3382
-------
3383
- indexer : ndarray of int
3383
+ indexer : np. ndarray[np.intp]
3384
3384
Integers from 0 to n - 1 indicating that the index at these
3385
3385
positions matches the corresponding target values. Missing values
3386
3386
in the target are marked by -1.
@@ -4610,7 +4610,7 @@ def _can_hold_identifiers_and_holds_name(self, name) -> bool:
4610
4610
return name in self
4611
4611
return False
4612
4612
4613
- def append (self , other ) -> Index :
4613
+ def append (self , other : Index | Sequence [ Index ] ) -> Index :
4614
4614
"""
4615
4615
Append a collection of Index options together.
4616
4616
@@ -4627,7 +4627,9 @@ def append(self, other) -> Index:
4627
4627
if isinstance (other , (list , tuple )):
4628
4628
to_concat += list (other )
4629
4629
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]
4631
4633
4632
4634
for obj in to_concat :
4633
4635
if not isinstance (obj , Index ):
@@ -5181,11 +5183,11 @@ def set_value(self, arr, key, value):
5181
5183
5182
5184
Returns
5183
5185
-------
5184
- indexer : ndarray of int
5186
+ indexer : np. ndarray[np.intp]
5185
5187
Integers from 0 to n - 1 indicating that the index at these
5186
5188
positions matches the corresponding target values. Missing values
5187
5189
in the target are marked by -1.
5188
- missing : ndarray of int
5190
+ missing : np. ndarray[np.intp]
5189
5191
An indexer into the target of the values not found.
5190
5192
These correspond to the -1 in the indexer array.
5191
5193
"""
@@ -5227,7 +5229,7 @@ def get_indexer_for(self, target, **kwargs) -> np.ndarray:
5227
5229
5228
5230
Returns
5229
5231
-------
5230
- numpy .ndarray
5232
+ np .ndarray[np.intp]
5231
5233
List of indices.
5232
5234
"""
5233
5235
if self ._index_as_unique :
0 commit comments