Skip to content

Commit 8df36f7

Browse files
1 parent 020f5a3 commit 8df36f7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas/_libs/tslibs/fields.pyx

+4-5
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,14 @@ def get_start_end_field(
246246
if freqstr:
247247
if freqstr == "C":
248248
raise ValueError(f"Custom business days is not supported by {field}")
249-
is_business = freqstr[0] == "B"
250-
249+
period_str = "".join([
250+
dt_char for dt_char in list(freqstr.split("-")[0]) if not dt_char.isdigit()
251+
])
252+
is_business = period_str == "B"
251253
# YearBegin(), BYearBegin() use month = starting month of year.
252254
# QuarterBegin(), BQuarterBegin() use startingMonth = starting
253255
# month of year. Other offsets use month, startingMonth as ending
254256
# month of year.
255-
period_str = "".join([
256-
dt_char for dt_char in list(freqstr.split("-")[0]) if not dt_char.isdigit()
257-
])
258257
if (period_str in ["MS", "QS", "YS"]):
259258
end_month = 12 if month_kw == 1 else month_kw - 1
260259
start_month = month_kw

0 commit comments

Comments
 (0)