Skip to content

BUG: renaming offsets quarterly frequencies with various fiscal year ends #55711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
25 changes: 23 additions & 2 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4616,7 +4616,28 @@ _lite_rule_alias = {
"ns": "ns",
}

_dont_uppercase = {"h", "bh", "cbh", "MS", "ms", "s", "me", "qe"}
_dont_uppercase = {
"h",
"bh",
"cbh",
"MS",
"ms",
"s",
"me",
"qe",
"qe-dec",
"qe-jan",
"qe-feb",
"qe-mar",
"qe-apr",
"qe-may",
"qe-jun",
"qe-jul",
"qe-aug",
"qe-sep",
"qe-oct",
"qe-nov",
}


INVALID_FREQ_ERR_MSG = "Invalid frequency: {0}"
Expand All @@ -4635,7 +4656,7 @@ def _get_offset(name: str) -> BaseOffset:
--------
_get_offset('EOM') --> BMonthEnd(1)
"""
if name not in _dont_uppercase:
if name.lower() not in _dont_uppercase:
name = name.upper()
name = _lite_rule_alias.get(name, name)
name = _lite_rule_alias.get(name.lower(), name)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/resample/test_period_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_basic_downsample(self, simple_period_range_series):
"rule,expected_error_msg",
[
("y-dec", "<YearEnd: month=12>"),
("qe-mar", "<QuarterEnd: startingMonth=3>"),
("Q-MAR", "<QuarterEnd: startingMonth=3>"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice - this is a period, so indeed the period alias should be used

Copy link
Contributor Author

@natmokval natmokval Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, sorry I missed it in PR #55553

("M", "<MonthEnd>"),
("w-thu", "<Week: weekday=3>"),
],
Expand Down