Skip to content

Commit 9cadda1

Browse files
committed
Remove limitation that seconds has two or fewer digits
- ISO 8601 doesn't seem to express that explicit limitations here are necessary.
1 parent d35d366 commit 9cadda1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,11 +662,8 @@ cdef inline int64_t parse_iso_format_string(str ts) except? -1:
662662
r = timedelta_from_spec(number, '0', dec_unit)
663663
result += timedelta_as_neg(r, neg)
664664
else: # seconds
665-
if len(number) <= 2:
666-
r = timedelta_from_spec(number, '0', 'S')
667-
result += timedelta_as_neg(r, neg)
668-
else:
669-
raise ValueError(err_msg)
665+
r = timedelta_from_spec(number, '0', 'S')
666+
result += timedelta_as_neg(r, neg)
670667
else:
671668
raise ValueError(err_msg)
672669

pandas/tests/scalar/timedelta/test_constructors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def test_overflow_on_construction():
234234
("P1D", Timedelta(days=1)),
235235
("P1DT1H", Timedelta(days=1, hours=1)),
236236
("P1W", Timedelta(days=7)),
237+
("PT300S", Timedelta(seconds=300)),
237238
],
238239
)
239240
def test_iso_constructor(fmt, exp):

0 commit comments

Comments
 (0)