Skip to content

Commit a143dcd

Browse files
GH 956 PR feedback
1 parent 485ddd0 commit a143dcd

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pandas-stubs/core/tools/timedeltas.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ from pandas._libs.tslibs.timedeltas import TimeDeltaUnitChoices
1414
from pandas._typing import (
1515
ArrayLike,
1616
RaiseCoerce,
17+
SequenceNotStr,
1718
)
1819

1920
@overload
@@ -31,7 +32,8 @@ def to_timedelta(
3132
@overload
3233
def to_timedelta(
3334
arg: (
34-
Sequence[str | float | timedelta]
35+
SequenceNotStr[str]
36+
| Sequence[float | timedelta]
3537
| tuple[str | float | timedelta, ...]
3638
| range
3739
| ArrayLike

tests/test_timefuncs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
from pandas._typing import FulldatetimeDict
2626
else:
2727
FulldatetimeDict = Any
28-
from pandas._typing import TimeUnit
28+
from pandas._typing import (
29+
SequenceNotStr,
30+
TimeUnit,
31+
)
2932

3033
from tests import (
3134
PD_LTE_22,
@@ -141,7 +144,8 @@ def test_timedelta_series_arithmetic() -> None:
141144

142145

143146
def test_timedelta_series_string() -> None:
144-
check(assert_type(pd.to_timedelta(["1 day"]), pd.TimedeltaIndex), pd.TimedeltaIndex)
147+
seq_list: SequenceNotStr[str] = ["1 day"]
148+
check(assert_type(pd.to_timedelta(seq_list), pd.TimedeltaIndex), pd.TimedeltaIndex)
145149

146150

147151
def test_timestamp_timedelta_series_arithmetic() -> None:

0 commit comments

Comments
 (0)