51
51
Axis ,
52
52
AxisInt ,
53
53
DropKeep ,
54
+ Dtype ,
54
55
DtypeObj ,
55
56
F ,
56
57
IgnoreRaise ,
@@ -1035,7 +1036,7 @@ def view(self, cls=None):
1035
1036
result ._id = self ._id
1036
1037
return result
1037
1038
1038
- def astype (self , dtype , copy : bool = True ):
1039
+ def astype (self , dtype : Dtype | None = None , copy : bool = True ):
1039
1040
"""
1040
1041
Create an Index with values cast to dtypes.
1041
1042
@@ -1229,7 +1230,7 @@ def _maybe_disallow_fill(self, allow_fill: bool, fill_value, indices) -> bool:
1229
1230
"""
1230
1231
1231
1232
@Appender (_index_shared_docs ["repeat" ] % _index_doc_kwargs )
1232
- def repeat (self , repeats , axis = None ):
1233
+ def repeat (self , repeats , axis : AxisInt | None = None ):
1233
1234
repeats = ensure_platform_int (repeats )
1234
1235
nv .validate_repeat ((), {"axis" : axis })
1235
1236
res_values = self ._values .repeat (repeats )
@@ -3216,7 +3217,7 @@ def _dti_setop_align_tzs(self, other: Index, setop: str_t) -> tuple[Index, Index
3216
3217
return self , other
3217
3218
3218
3219
@final
3219
- def union (self , other , sort = None ):
3220
+ def union (self , other , sort : bool | None = None ):
3220
3221
"""
3221
3222
Form the union of two Index objects.
3222
3223
@@ -3578,7 +3579,7 @@ def _intersection_via_get_indexer(
3578
3579
return result
3579
3580
3580
3581
@final
3581
- def difference (self , other , sort = None ):
3582
+ def difference (self , other , sort : bool | None = None ):
3582
3583
"""
3583
3584
Return a new Index with elements of index not in `other`.
3584
3585
@@ -3662,7 +3663,9 @@ def _wrap_difference_result(self, other, result):
3662
3663
# We will override for MultiIndex to handle empty results
3663
3664
return self ._wrap_setop_result (other , result )
3664
3665
3665
- def symmetric_difference (self , other , result_name = None , sort = None ):
3666
+ def symmetric_difference (
3667
+ self , other , result_name : str | None = None , sort : bool | None = None
3668
+ ):
3666
3669
"""
3667
3670
Compute the symmetric difference of two Index objects.
3668
3671
@@ -6450,7 +6453,7 @@ def _transform_index(self, func, *, level=None) -> Index:
6450
6453
items = [func (x ) for x in self ]
6451
6454
return Index (items , name = self .name , tupleize_cols = False )
6452
6455
6453
- def isin (self , values , level = None ) -> npt .NDArray [np .bool_ ]:
6456
+ def isin (self , values , level : str | int = None ) -> npt .NDArray [np .bool_ ]:
6454
6457
"""
6455
6458
Return a boolean array where the index values are in `values`.
6456
6459
@@ -6750,7 +6753,9 @@ def get_slice_bound(self, label, side: Literal["left", "right"]) -> int:
6750
6753
else :
6751
6754
return slc
6752
6755
6753
- def slice_locs (self , start = None , end = None , step = None ) -> tuple [int , int ]:
6756
+ def slice_locs (
6757
+ self , start : str | None = None , end : str | None = None , step : int | None = None
6758
+ ) -> tuple [int , int ]:
6754
6759
"""
6755
6760
Compute slice locations for input labels.
6756
6761
@@ -6838,7 +6843,7 @@ def slice_locs(self, start=None, end=None, step=None) -> tuple[int, int]:
6838
6843
6839
6844
return start_slice , end_slice
6840
6845
6841
- def delete (self , loc ) -> Self :
6846
+ def delete (self , loc : int | list [ int ] ) -> Self :
6842
6847
"""
6843
6848
Make new Index with passed location(-s) deleted.
6844
6849
@@ -7269,7 +7274,9 @@ def _maybe_disable_logical_methods(self, opname: str_t) -> None:
7269
7274
make_invalid_op (opname )(self )
7270
7275
7271
7276
@Appender (IndexOpsMixin .argmin .__doc__ )
7272
- def argmin (self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs ) -> int :
7277
+ def argmin (
7278
+ self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs
7279
+ ) -> int :
7273
7280
nv .validate_argmin (args , kwargs )
7274
7281
nv .validate_minmax_axis (axis )
7275
7282
@@ -7288,7 +7295,9 @@ def argmin(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs
7288
7295
return super ().argmin (skipna = skipna )
7289
7296
7290
7297
@Appender (IndexOpsMixin .argmax .__doc__ )
7291
- def argmax (self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs ) -> int :
7298
+ def argmax (
7299
+ self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs
7300
+ ) -> int :
7292
7301
nv .validate_argmax (args , kwargs )
7293
7302
nv .validate_minmax_axis (axis )
7294
7303
@@ -7306,7 +7315,7 @@ def argmax(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs
7306
7315
return - 1
7307
7316
return super ().argmax (skipna = skipna )
7308
7317
7309
- def min (self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs ):
7318
+ def min (self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs ):
7310
7319
"""
7311
7320
Return the minimum value of the Index.
7312
7321
@@ -7369,7 +7378,7 @@ def min(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs):
7369
7378
7370
7379
return nanops .nanmin (self ._values , skipna = skipna )
7371
7380
7372
- def max (self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs ):
7381
+ def max (self , axis : AxisInt | None = None , skipna : bool = True , * args , ** kwargs ):
7373
7382
"""
7374
7383
Return the maximum value of the Index.
7375
7384
0 commit comments