Skip to content

Commit a347e76

Browse files
authored
ERR: Fix to_timedelta error message (#34981)
1 parent 9c77845 commit a347e76

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ class Timedelta(_Timedelta):
11511151

11521152
if unit in {'Y', 'y', 'M'}:
11531153
raise ValueError(
1154-
"Units 'M' and 'Y' are no longer supported, as they do not "
1154+
"Units 'M', 'Y', and 'y' are no longer supported, as they do not "
11551155
"represent unambiguous timedelta values durations."
11561156
)
11571157

pandas/core/indexes/timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def __new__(
136136

137137
if unit in {"Y", "y", "M"}:
138138
raise ValueError(
139-
"Units 'M' and 'Y' are no longer supported, as they do not "
139+
"Units 'M', 'Y', and 'y' are no longer supported, as they do not "
140140
"represent unambiguous timedelta values durations."
141141
)
142142

pandas/core/tools/timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def to_timedelta(arg, unit=None, errors="raise"):
9494

9595
if unit in {"Y", "y", "M"}:
9696
raise ValueError(
97-
"Units 'M' and 'Y' are no longer supported, as they do not "
97+
"Units 'M', 'Y', and 'y' are no longer supported, as they do not "
9898
"represent unambiguous timedelta values durations."
9999
)
100100

pandas/tests/indexes/timedeltas/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class TestTimedeltaIndex:
1313
@pytest.mark.parametrize("unit", ["Y", "y", "M"])
1414
def test_unit_m_y_raises(self, unit):
15-
msg = "Units 'M' and 'Y' are no longer supported"
15+
msg = "Units 'M', 'Y', and 'y' are no longer supported"
1616
with pytest.raises(ValueError, match=msg):
1717
TimedeltaIndex([1, 3, 7], unit)
1818

pandas/tests/scalar/timedelta/test_timedelta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def test_unit_parser(self, units, np_unit, wrapper):
265265

266266
@pytest.mark.parametrize("unit", ["Y", "y", "M"])
267267
def test_unit_m_y_raises(self, unit):
268-
msg = "Units 'M' and 'Y' are no longer supported"
268+
msg = "Units 'M', 'Y', and 'y' are no longer supported"
269269
with pytest.raises(ValueError, match=msg):
270270
Timedelta(10, unit)
271271

0 commit comments

Comments
 (0)