File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ from pandas._libs.tslibs.timedeltas import TimeDeltaUnitChoices
14
14
from pandas ._typing import (
15
15
ArrayLike ,
16
16
RaiseCoerce ,
17
+ SequenceNotStr ,
17
18
)
18
19
19
20
@overload
@@ -31,8 +32,8 @@ def to_timedelta(
31
32
@overload
32
33
def to_timedelta (
33
34
arg : (
34
- Sequence [ float | timedelta ]
35
- | list [ str | float | timedelta ]
35
+ SequenceNotStr
36
+ | Sequence [ float | timedelta ]
36
37
| tuple [str | float | timedelta , ...]
37
38
| range
38
39
| ArrayLike
Original file line number Diff line number Diff line change @@ -140,6 +140,11 @@ def test_timedelta_series_arithmetic() -> None:
140
140
r4 : pd .TimedeltaIndex = tds1 / 10.2
141
141
142
142
143
+ def test_timedelta_series_string () -> None :
144
+ seq_list = ["1 day" ]
145
+ check (assert_type (pd .to_timedelta (seq_list ), pd .TimedeltaIndex ), pd .TimedeltaIndex )
146
+
147
+
143
148
def test_timestamp_timedelta_series_arithmetic () -> None :
144
149
ts1 = pd .to_datetime (pd .Series (["2022-03-05" , "2022-03-06" ]))
145
150
assert isinstance (ts1 .iloc [0 ], pd .Timestamp )
You can’t perform that action at this time.
0 commit comments