Skip to content

Commit 9643679

Browse files
authored
BUG: renaming offsets quarterly frequencies with various fiscal year ends (#55711)
* add offsets quarterly frequencies with various fiscal year ends to _dont_uppercase, fix test * simplify the condition in _get_offset
1 parent 2d2d67d commit 9643679

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

pandas/_libs/tslibs/offsets.pyx

+23-2
Original file line numberDiff line numberDiff line change
@@ -4616,7 +4616,28 @@ _lite_rule_alias = {
46164616
"ns": "ns",
46174617
}
46184618

4619-
_dont_uppercase = {"h", "bh", "cbh", "MS", "ms", "s", "me", "qe"}
4619+
_dont_uppercase = {
4620+
"h",
4621+
"bh",
4622+
"cbh",
4623+
"MS",
4624+
"ms",
4625+
"s",
4626+
"me",
4627+
"qe",
4628+
"qe-dec",
4629+
"qe-jan",
4630+
"qe-feb",
4631+
"qe-mar",
4632+
"qe-apr",
4633+
"qe-may",
4634+
"qe-jun",
4635+
"qe-jul",
4636+
"qe-aug",
4637+
"qe-sep",
4638+
"qe-oct",
4639+
"qe-nov",
4640+
}
46204641

46214642

46224643
INVALID_FREQ_ERR_MSG = "Invalid frequency: {0}"
@@ -4635,7 +4656,7 @@ def _get_offset(name: str) -> BaseOffset:
46354656
--------
46364657
_get_offset('EOM') --> BMonthEnd(1)
46374658
"""
4638-
if name not in _dont_uppercase:
4659+
if name.lower() not in _dont_uppercase:
46394660
name = name.upper()
46404661
name = _lite_rule_alias.get(name, name)
46414662
name = _lite_rule_alias.get(name.lower(), name)

pandas/tests/resample/test_period_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_basic_downsample(self, simple_period_range_series):
134134
"rule,expected_error_msg",
135135
[
136136
("y-dec", "<YearEnd: month=12>"),
137-
("qe-mar", "<QuarterEnd: startingMonth=3>"),
137+
("Q-MAR", "<QuarterEnd: startingMonth=3>"),
138138
("M", "<MonthEnd>"),
139139
("w-thu", "<Week: weekday=3>"),
140140
],

0 commit comments

Comments
 (0)