@@ -6,6 +6,7 @@ from typing import (
6
6
Any ,
7
7
Generic ,
8
8
Literal ,
9
+ TypeAlias ,
9
10
final ,
10
11
overload ,
11
12
)
@@ -22,18 +23,22 @@ from typing_extensions import Self
22
23
23
24
from pandas ._typing import (
24
25
S1 ,
26
+ ArrayLike ,
25
27
AxisIndex ,
26
28
DropKeep ,
27
29
DTypeLike ,
28
30
GenericT ,
29
31
GenericT_co ,
30
32
NDFrameT ,
31
33
Scalar ,
34
+ SequenceNotStr ,
32
35
SupportsDType ,
33
36
np_1darray ,
34
37
)
35
38
from pandas .util ._decorators import cache_readonly
36
39
40
+ _ListLike : TypeAlias = ArrayLike | dict [str , np .ndarray ] | SequenceNotStr [S1 ]
41
+
37
42
class NoNewAttributesMixin :
38
43
def __setattr__ (self , key : str , value : Any ) -> None : ...
39
44
@@ -51,7 +56,7 @@ class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
51
56
@property
52
57
def T (self ) -> Self : ...
53
58
@property
54
- def shape (self ) -> tuple : ...
59
+ def shape (self ) -> tuple [ int , ...] : ...
55
60
@property
56
61
def ndim (self ) -> int : ...
57
62
def item (self ) -> S1 : ...
@@ -67,41 +72,45 @@ class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
67
72
dtype : None = None ,
68
73
copy : bool = False ,
69
74
na_value : Scalar = ...,
70
- ** kwargs ,
75
+ ** kwargs : Any ,
71
76
) -> np_1darray [GenericT_co ]: ...
72
77
@overload
73
78
def to_numpy (
74
79
self ,
75
80
dtype : np .dtype [GenericT ] | SupportsDType [GenericT ] | type [GenericT ],
76
81
copy : bool = False ,
77
82
na_value : Scalar = ...,
78
- ** kwargs ,
83
+ ** kwargs : Any ,
79
84
) -> np_1darray [GenericT ]: ...
80
85
@overload
81
86
def to_numpy (
82
87
self ,
83
88
dtype : DTypeLike ,
84
89
copy : bool = False ,
85
90
na_value : Scalar = ...,
86
- ** kwargs ,
91
+ ** kwargs : Any ,
87
92
) -> np_1darray : ...
88
93
@property
89
94
def empty (self ) -> bool : ...
90
- def max (self , axis = ..., skipna : bool = ..., ** kwargs ): ...
91
- def min (self , axis = ..., skipna : bool = ..., ** kwargs ): ...
95
+ def max (
96
+ self , axis : AxisIndex | None = ..., skipna : bool = ..., ** kwargs : Any
97
+ ) -> S1 : ...
98
+ def min (
99
+ self , axis : AxisIndex | None = ..., skipna : bool = ..., ** kwargs : Any
100
+ ) -> S1 : ...
92
101
def argmax (
93
102
self ,
94
103
axis : AxisIndex | None = ...,
95
104
skipna : bool = True ,
96
- * args ,
97
- ** kwargs ,
105
+ * args : Any ,
106
+ ** kwargs : Any ,
98
107
) -> np .int64 : ...
99
108
def argmin (
100
109
self ,
101
110
axis : AxisIndex | None = ...,
102
111
skipna : bool = True ,
103
- * args ,
104
- ** kwargs ,
112
+ * args : Any ,
113
+ ** kwargs : Any ,
105
114
) -> np .int64 : ...
106
115
def tolist (self ) -> list [S1 ]: ...
107
116
def to_list (self ) -> list [S1 ]: ...
@@ -114,7 +123,7 @@ class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
114
123
normalize : Literal [False ] = ...,
115
124
sort : bool = ...,
116
125
ascending : bool = ...,
117
- bins = ...,
126
+ bins : int | None = ...,
118
127
dropna : bool = ...,
119
128
) -> Series [int ]: ...
120
129
@overload
@@ -123,7 +132,7 @@ class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
123
132
normalize : Literal [True ],
124
133
sort : bool = ...,
125
134
ascending : bool = ...,
126
- bins = ...,
135
+ bins : int | None = ...,
127
136
dropna : bool = ...,
128
137
) -> Series [float ]: ...
129
138
def nunique (self , dropna : bool = True ) -> int : ...
@@ -136,7 +145,18 @@ class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
136
145
def factorize (
137
146
self , sort : bool = False , use_na_sentinel : bool = True
138
147
) -> tuple [np_1darray , np_1darray | Index | Categorical ]: ...
148
+ @overload
149
+ def searchsorted (
150
+ self ,
151
+ value : _ListLike ,
152
+ side : Literal ["left" , "right" ] = ...,
153
+ sorter : _ListLike | None = ...,
154
+ ) -> np_1darray [np .intp ]: ...
155
+ @overload
139
156
def searchsorted (
140
- self , value , side : Literal ["left" , "right" ] = ..., sorter = ...
141
- ) -> int | list [int ]: ...
157
+ self ,
158
+ value : Scalar ,
159
+ side : Literal ["left" , "right" ] = ...,
160
+ sorter : _ListLike | None = ...,
161
+ ) -> np .intp : ...
142
162
def drop_duplicates (self , * , keep : DropKeep = ...) -> Self : ...
0 commit comments