diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 1c3e69e21aa18..2862e62e3d522 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1151,7 +1151,7 @@ class Timedelta(_Timedelta): if unit in {'Y', 'y', 'M'}: raise ValueError( - "Units 'M' and 'Y' are no longer supported, as they do not " + "Units 'M', 'Y', and 'y' are no longer supported, as they do not " "represent unambiguous timedelta values durations." ) diff --git a/pandas/core/indexes/timedeltas.py b/pandas/core/indexes/timedeltas.py index f6661c6b50dfb..dccc8369c5366 100644 --- a/pandas/core/indexes/timedeltas.py +++ b/pandas/core/indexes/timedeltas.py @@ -136,7 +136,7 @@ def __new__( if unit in {"Y", "y", "M"}: raise ValueError( - "Units 'M' and 'Y' are no longer supported, as they do not " + "Units 'M', 'Y', and 'y' are no longer supported, as they do not " "represent unambiguous timedelta values durations." ) diff --git a/pandas/core/tools/timedeltas.py b/pandas/core/tools/timedeltas.py index a643c312ec358..e457a8819f27a 100644 --- a/pandas/core/tools/timedeltas.py +++ b/pandas/core/tools/timedeltas.py @@ -94,7 +94,7 @@ def to_timedelta(arg, unit=None, errors="raise"): if unit in {"Y", "y", "M"}: raise ValueError( - "Units 'M' and 'Y' are no longer supported, as they do not " + "Units 'M', 'Y', and 'y' are no longer supported, as they do not " "represent unambiguous timedelta values durations." ) diff --git a/pandas/tests/indexes/timedeltas/test_constructors.py b/pandas/tests/indexes/timedeltas/test_constructors.py index acc68dfe7301f..41e4e220c999c 100644 --- a/pandas/tests/indexes/timedeltas/test_constructors.py +++ b/pandas/tests/indexes/timedeltas/test_constructors.py @@ -12,7 +12,7 @@ class TestTimedeltaIndex: @pytest.mark.parametrize("unit", ["Y", "y", "M"]) def test_unit_m_y_raises(self, unit): - msg = "Units 'M' and 'Y' are no longer supported" + msg = "Units 'M', 'Y', and 'y' are no longer supported" with pytest.raises(ValueError, match=msg): TimedeltaIndex([1, 3, 7], unit) diff --git a/pandas/tests/scalar/timedelta/test_timedelta.py b/pandas/tests/scalar/timedelta/test_timedelta.py index 38e77321418d1..a01921bd6c4c2 100644 --- a/pandas/tests/scalar/timedelta/test_timedelta.py +++ b/pandas/tests/scalar/timedelta/test_timedelta.py @@ -265,7 +265,7 @@ def test_unit_parser(self, units, np_unit, wrapper): @pytest.mark.parametrize("unit", ["Y", "y", "M"]) def test_unit_m_y_raises(self, unit): - msg = "Units 'M' and 'Y' are no longer supported" + msg = "Units 'M', 'Y', and 'y' are no longer supported" with pytest.raises(ValueError, match=msg): Timedelta(10, unit)