@@ -7,12 +7,17 @@ from typing import (
7
7
import numpy as np
8
8
from pandas import (
9
9
Categorical ,
10
+ CategoricalDtype ,
11
+ DatetimeIndex ,
10
12
Float64Index ,
11
13
Index ,
12
14
Int64Index ,
15
+ Interval ,
13
16
IntervalIndex ,
14
17
Series ,
18
+ Timestamp ,
15
19
)
20
+ from pandas .core .series import TimestampSeries
16
21
17
22
from pandas ._typing import (
18
23
Label ,
@@ -46,6 +51,36 @@ def cut(
46
51
ordered : bool = ...,
47
52
) -> tuple [npt .NDArray [np .intp ], IntervalIndex ]: ...
48
53
@overload
54
+ def cut ( # type: ignore[misc]
55
+ x : TimestampSeries ,
56
+ bins : int
57
+ | TimestampSeries
58
+ | DatetimeIndex
59
+ | Sequence [Timestamp ]
60
+ | Sequence [np .datetime64 ],
61
+ right : bool = ...,
62
+ labels : Literal [False ] | Sequence [Label ] | None = ...,
63
+ * ,
64
+ retbins : Literal [True ],
65
+ precision : int = ...,
66
+ include_lowest : bool = ...,
67
+ duplicates : Literal ["raise" , "drop" ] = ...,
68
+ ordered : bool = ...,
69
+ ) -> tuple [Series , DatetimeIndex ]: ...
70
+ @overload
71
+ def cut (
72
+ x : TimestampSeries ,
73
+ bins : IntervalIndex [Interval [Timestamp ]],
74
+ right : bool = ...,
75
+ labels : Sequence [Label ] | None = ...,
76
+ * ,
77
+ retbins : Literal [True ],
78
+ precision : int = ...,
79
+ include_lowest : bool = ...,
80
+ duplicates : Literal ["raise" , "drop" ] = ...,
81
+ ordered : bool = ...,
82
+ ) -> tuple [Series , DatetimeIndex ]: ...
83
+ @overload
49
84
def cut (
50
85
x : Series ,
51
86
bins : int | Series | Int64Index | Float64Index | Sequence [int ] | Sequence [float ],
@@ -61,7 +96,7 @@ def cut(
61
96
@overload
62
97
def cut (
63
98
x : Series ,
64
- bins : IntervalIndex ,
99
+ bins : IntervalIndex [ Interval [ int ]] | IntervalIndex [ Interval [ float ]] ,
65
100
right : bool = ...,
66
101
labels : Sequence [Label ] | None = ...,
67
102
* ,
@@ -117,6 +152,23 @@ def cut(
117
152
ordered : bool = ...,
118
153
) -> npt .NDArray [np .intp ]: ...
119
154
@overload
155
+ def cut (
156
+ x : TimestampSeries ,
157
+ bins : int
158
+ | TimestampSeries
159
+ | DatetimeIndex
160
+ | Sequence [Timestamp ]
161
+ | Sequence [np .datetime64 ]
162
+ | IntervalIndex [Interval [Timestamp ]],
163
+ right : bool = ...,
164
+ labels : Literal [False ] | Sequence [Label ] | None = ...,
165
+ retbins : Literal [False ] = ...,
166
+ precision : int = ...,
167
+ include_lowest : bool = ...,
168
+ duplicates : Literal ["raise" , "drop" ] = ...,
169
+ ordered : bool = ...,
170
+ ) -> Series [CategoricalDtype ]: ...
171
+ @overload
120
172
def cut (
121
173
x : Series ,
122
174
bins : int
0 commit comments