Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 26 additions & 0 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5202,6 +5202,32 @@ deprec_to_valid_alias = {
"L": "ms",
"U": "us",
"N": "ns",
"AS": "YS",
"AS-JAN": "YS-JAN",
"AS-FEB": "YS-FEB",
"AS-MAR": "YS-MAR",
"AS-APR": "YS-APR",
"AS-MAY": "YS-MAY",
"AS-JUN": "YS-JUN",
"AS-JUL": "YS-JUL",
"AS-AUG": "YS-AUG",
"AS-SEP": "YS-SEP",
"AS-OCT": "YS-OCT",
"AS-NOV": "YS-NOV",
"AS-DEC": "YS-DEC",
"A": "Y",
"A-JAN": "Y-JAN",
"A-FEB": "Y-FEB",
"A-MAR": "Y-MAR",
"A-APR": "Y-APR",
"A-MAY": "Y-MAY",
"A-JUN": "Y-JUN",
"A-JUL": "Y-JUL",
"A-AUG": "Y-AUG",
"A-SEP": "Y-SEP",
"A-OCT": "Y-OCT",
"A-NOV": "Y-NOV",
"A-DEC": "Y-DEC",
}


Expand Down
16 changes: 16 additions & 0 deletions pandas/tests/indexes/datetimes/test_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,22 @@ def test_date_range_depr_lowercase_frequency(self, freq, freq_depr):
result = date_range("1/1/2000", periods=4, freq=freq_depr)
tm.assert_index_equal(result, expected)

@pytest.mark.parametrize(
"freq_removed,freq",
[
("100A", "Y"),
("2A-DEC", "Y-DEC"),
("100AS", "YS"),
("2AS-MAY", "YS-MAY"),
],
)
def test_error_message_for_removed_year_yearbegin_frequencies(
self, freq, freq_removed
):
msg = f"Did you mean {freq}"
with pytest.raises(ValueError, match=msg):
date_range("1/1/2000", periods=2, freq=freq_removed)


class TestDateRangeTZ:
"""Tests for date_range with timezones"""
Expand Down
Loading