Skip to content

Commit 5eb1110

Browse files
PERF: use private variables directly for CustomBusinessDay (#63984)
1 parent b95e838 commit 5eb1110

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pandas/_libs/tslibs/offsets.pyx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6435,19 +6435,19 @@ cdef class CustomBusinessDay(BusinessDay):
64356435
np_dt = np.datetime64(date_in.date())
64366436

64376437
np_incr_dt = np.busday_offset(
6438-
np_dt, self._n, roll=roll, busdaycal=self.calendar
6438+
np_dt, self._n, roll=roll, busdaycal=self._calendar
64396439
)
64406440

64416441
dt_date = np_incr_dt.astype(datetime)
64426442
result = datetime.combine(dt_date, date_in.time())
64436443

6444-
if self.offset:
6445-
result = result + self.offset
6444+
if self._offset:
6445+
result = result + self._offset
64466446
return result
64476447

64486448
elif is_any_td_scalar(other):
6449-
td = Timedelta(self.offset) + other
6450-
return BDay(self._n, offset=td.to_pytimedelta(), normalize=self.normalize)
6449+
td = Timedelta(self._offset) + other
6450+
return BDay(self._n, offset=td.to_pytimedelta(), normalize=self._normalize)
64516451
else:
64526452
raise ApplyTypeError(
64536453
"Only know how to combine trading day with "
@@ -6517,10 +6517,10 @@ cdef class CustomBusinessDay(BusinessDay):
65176517
>>> pd.offsets.CustomBusinessDay(normalize=True).is_on_offset(ts)
65186518
True
65196519
"""
6520-
if self.normalize and not _is_normalized(dt):
6520+
if self._normalize and not _is_normalized(dt):
65216521
return False
65226522
day64 = _to_dt64D(dt)
6523-
return np.is_busday(day64, busdaycal=self.calendar)
6523+
return np.is_busday(day64, busdaycal=self._calendar)
65246524

65256525

65266526
cdef class CustomBusinessHour(BusinessHour):

0 commit comments

Comments
 (0)