File tree 2 files changed +4
-1
lines changed
2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,7 @@ Performance improvements
385
385
- Performance improvement when setting values in a pyarrow backed string array (:issue: `46400 `)
386
386
- Performance improvement in :func: `factorize ` (:issue: `46109 `)
387
387
- Performance improvement in :class: `DataFrame ` and :class: `Series ` constructors for extension dtype scalars (:issue: `45854 `)
388
+ - Performance improvement in :class: `BusinessHour `, ``repr `` is now 4 times faster ! (related to :issue: `44764 `)
388
389
389
390
.. ---------------------------------------------------------------------------
390
391
.. _whatsnew_150.bug_fixes :
Original file line number Diff line number Diff line change @@ -1566,8 +1566,10 @@ cdef class BusinessHour(BusinessMixin):
1566
1566
1567
1567
def _repr_attrs (self ) -> str:
1568
1568
out = super ()._repr_attrs()
1569
+ # Use python string formatting to be faster than strftime
1570
+ # f'{st.strftime("%H:%M")}-{en.strftime("%H:%M")}'
1569
1571
hours = " ," .join(
1570
- f' {st.strftime(" %H : %M ")} -{en.strftime(" %H : %M ") }'
1572
+ f' {st.hour:02d}:{st.minute:02d} -{en.hour:02d}:{en.minute:02d }'
1571
1573
for st, en in zip (self .start, self .end)
1572
1574
)
1573
1575
attrs = [f" {self._prefix}={hours}" ]
You can’t perform that action at this time.
0 commit comments