File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
- # def to_timedelta(arg, unit: str = ..., errors: str = ...): ...
2
1
from datetime import timedelta
3
- from typing import overload
2
+ from typing import (
3
+ Sequence ,
4
+ overload ,
5
+ )
4
6
5
7
from pandas import Index
6
8
from pandas .core .indexes .timedeltas import TimedeltaIndex
@@ -16,11 +18,10 @@ from pandas._typing import (
16
18
DateTimeErrorChoices ,
17
19
)
18
20
19
- # Copied from pandas/_libs/tslibs/timedeltas.pyx
20
-
21
21
@overload
22
22
def to_timedelta (
23
23
arg : str | float | timedelta ,
24
+ # TODO: Check all UnitChoices are valid
24
25
unit : UnitChoices | None = ...,
25
26
errors : DateTimeErrorChoices = ...,
26
27
) -> Timedelta : ...
@@ -32,7 +33,12 @@ def to_timedelta(
32
33
) -> TimedeltaSeries : ...
33
34
@overload
34
35
def to_timedelta (
35
- arg : list | tuple | range | ArrayLike | Index ,
36
+ arg : Sequence [float | timedelta ]
37
+ | list [str | float | timedelta ]
38
+ | tuple [str | float | timedelta , ...]
39
+ | range
40
+ | ArrayLike
41
+ | Index ,
36
42
unit : UnitChoices | None = ...,
37
43
errors : DateTimeErrorChoices = ...,
38
44
) -> TimedeltaIndex : ...
You can’t perform that action at this time.
0 commit comments