Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ Timedelta
^^^^^^^^^
- Accuracy improvement in :meth:`Timedelta.to_pytimedelta` to round microseconds consistently for large nanosecond based Timedelta (:issue:`57841`)
- Bug in :class:`Timedelta` constructor failing to raise when passed an invalid keyword (:issue:`53801`)
- Bug in :class:`Timedelta` constructor failing to recognize Week ('W') as a parsed string suffix (:issue:`12691`)
- Bug in :meth:`DataFrame.cumsum` which was raising ``IndexError`` if dtype is ``timedelta64[ns]`` (:issue:`57956`)
- Bug in multiplication operations with ``timedelta64`` dtype failing to raise ``TypeError`` when multiplying by ``bool`` objects or dtypes (:issue:`58054`)

Expand Down
10 changes: 10 additions & 0 deletions pandas/tests/scalar/timedelta/test_timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,13 @@ def test_to_pytimedelta_large_values():
result = td.to_pytimedelta()
expected = timedelta(days=13343, seconds=86304, microseconds=609987)
assert result == expected


def test_timedelta_week_suffix():
# GH#12691 ensure 'W' suffix works as a string passed to Timedelta
expected = Timedelta("7 days")
result = Timedelta(1, unit="W")
assert result == expected

result = Timedelta("1W")
assert result == expected
Loading