@@ -7,12 +7,17 @@ from typing import (
77import numpy as np
88from pandas import (
99 Categorical ,
10+ CategoricalDtype ,
11+ DatetimeIndex ,
1012 Float64Index ,
1113 Index ,
1214 Int64Index ,
15+ Interval ,
1316 IntervalIndex ,
1417 Series ,
18+ Timestamp ,
1519)
20+ from pandas .core .series import TimestampSeries
1621
1722from pandas ._typing import (
1823 Label ,
@@ -46,6 +51,36 @@ def cut(
4651 ordered : bool = ...,
4752) -> tuple [npt .NDArray [np .intp ], IntervalIndex ]: ...
4853@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
4984def cut (
5085 x : Series ,
5186 bins : int | Series | Int64Index | Float64Index | Sequence [int ] | Sequence [float ],
@@ -61,7 +96,7 @@ def cut(
6196@overload
6297def cut (
6398 x : Series ,
64- bins : IntervalIndex ,
99+ bins : IntervalIndex [ Interval [ int ]] | IntervalIndex [ Interval [ float ]] ,
65100 right : bool = ...,
66101 labels : Sequence [Label ] | None = ...,
67102 * ,
@@ -117,6 +152,23 @@ def cut(
117152 ordered : bool = ...,
118153) -> npt .NDArray [np .intp ]: ...
119154@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
120172def cut (
121173 x : Series ,
122174 bins : int
0 commit comments