Skip to content

Commit da667af

Browse files
authored
CLN/PERF: delay evaluation of get_day_of_month (#35866)
1 parent a23af4e commit da667af

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pandas/_libs/tslibs/offsets.pyx

+2-4
Original file line numberDiff line numberDiff line change
@@ -3705,7 +3705,7 @@ cdef inline void _shift_months(const int64_t[:] dtindex,
37053705
"""See shift_months.__doc__"""
37063706
cdef:
37073707
Py_ssize_t i
3708-
int months_to_roll, compare_day
3708+
int months_to_roll
37093709
npy_datetimestruct dts
37103710

37113711
for i in range(count):
@@ -3715,10 +3715,8 @@ cdef inline void _shift_months(const int64_t[:] dtindex,
37153715

37163716
dt64_to_dtstruct(dtindex[i], &dts)
37173717
months_to_roll = months
3718-
compare_day = get_day_of_month(&dts, day_opt)
37193718

3720-
months_to_roll = roll_convention(dts.day, months_to_roll,
3721-
compare_day)
3719+
months_to_roll = _roll_qtrday(&dts, months_to_roll, 0, day_opt)
37223720

37233721
dts.year = year_add_months(dts, months_to_roll)
37243722
dts.month = month_add_months(dts, months_to_roll)

0 commit comments

Comments
 (0)