Skip to content

Commit 020f5a3

Browse files
BUG: DatetimeIndex.is_year_start breaks on double-digit frequencies pandas-dev#58523
1 parent 9b22b12 commit 020f5a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/_libs/tslibs/fields.pyx

+4-3
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,10 @@ def get_start_end_field(
252252
# QuarterBegin(), BQuarterBegin() use startingMonth = starting
253253
# month of year. Other offsets use month, startingMonth as ending
254254
# month of year.
255-
256-
if (freqstr[0:2] in ["MS", "QS", "YS"]) or (
257-
freqstr[1:3] in ["MS", "QS", "YS"]):
255+
period_str = "".join([
256+
dt_char for dt_char in list(freqstr.split("-")[0]) if not dt_char.isdigit()
257+
])
258+
if (period_str in ["MS", "QS", "YS"]):
258259
end_month = 12 if month_kw == 1 else month_kw - 1
259260
start_month = month_kw
260261
else:

0 commit comments

Comments
 (0)