diff --git a/pandas/_libs/tslibs/dtypes.pyx b/pandas/_libs/tslibs/dtypes.pyx index 7e6e382c17cc6..4100f3d90e817 100644 --- a/pandas/_libs/tslibs/dtypes.pyx +++ b/pandas/_libs/tslibs/dtypes.pyx @@ -359,6 +359,8 @@ cdef dict c_PERIOD_AND_OFFSET_DEPR_FREQSTR = { "b": "B", "c": "C", "MIN": "min", + "US": "us", + "NS": "ns", } cdef str INVALID_FREQ_ERR_MSG = "Invalid frequency: {0}" diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index db35cc0c93237..5b913a3ccdea1 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -4695,15 +4695,16 @@ _lite_rule_alias = { "YS": "YS-JAN", # YearBegin(month=1), "BYE": "BYE-DEC", # BYearEnd(month=12), "BYS": "BYS-JAN", # BYearBegin(month=1), - - "Min": "min", - "min": "min", - "ms": "ms", - "us": "us", - "ns": "ns", } -_dont_uppercase = {"h", "bh", "cbh", "MS", "ms", "s"} +_dont_uppercase = { + "h", + "bh", + "cbh", + "MS", + "ms", + "s", +} INVALID_FREQ_ERR_MSG = "Invalid frequency: {0}" diff --git a/pandas/tests/arrays/test_datetimes.py b/pandas/tests/arrays/test_datetimes.py index de189b7e2f724..1e67acc22c486 100644 --- a/pandas/tests/arrays/test_datetimes.py +++ b/pandas/tests/arrays/test_datetimes.py @@ -760,7 +760,7 @@ def test_date_range_frequency_M_Q_Y_raises(self, freq): with pytest.raises(ValueError, match=msg): pd.date_range("1/1/2000", periods=4, freq=freq) - @pytest.mark.parametrize("freq_depr", ["2MIN", "2mS", "2Us"]) + @pytest.mark.parametrize("freq_depr", ["2MIN", "2NS", "2US"]) def test_date_range_uppercase_frequency_deprecated(self, freq_depr): # GH#9586, GH#54939 depr_msg = f"'{freq_depr[1:]}' is deprecated and will be removed in a " diff --git a/pandas/tests/tslibs/test_to_offset.py b/pandas/tests/tslibs/test_to_offset.py index 67521c7e2a3ac..569c7af3045df 100644 --- a/pandas/tests/tslibs/test_to_offset.py +++ b/pandas/tests/tslibs/test_to_offset.py @@ -204,7 +204,7 @@ def test_to_offset_lowercase_frequency_raises(freq_depr): to_offset(freq_depr) -@pytest.mark.parametrize("freq_depr", ["2MIN", "2Us", "2NS"]) +@pytest.mark.parametrize("freq_depr", ["2MIN", "2US", "2NS"]) def test_to_offset_uppercase_frequency_deprecated(freq_depr): # GH#54939 depr_msg = f"'{freq_depr[1:]}' is deprecated and will be removed in a "