File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 7171
7272from pandas .tseries .frequencies import get_period_alias
7373from pandas .tseries .offsets import (
74+ BusinessHour ,
75+ CustomBusinessDay ,
7476 Day ,
7577 Tick ,
7678)
@@ -825,12 +827,13 @@ def _add_offset(self, offset: BaseOffset) -> Self:
825827 ]
826828 res_unit = self .unit
827829 if hasattr (offset , "offset" ) and offset .offset is not None :
828- offset_td = Timedelta (offset .offset )
829- if offset_td .value != 0 :
830- offset_unit = offset_td .unit
831- idx_self = units .index (self .unit )
832- idx_offset = units .index (offset_unit )
833- res_unit = units [min (idx_self , idx_offset )]
830+ if isinstance (offset , (CustomBusinessDay , BusinessHour )):
831+ offset_td = Timedelta (offset .offset )
832+ if offset_td .value != 0 :
833+ offset_unit = offset_td .unit
834+ idx_self = units .index (self .unit )
835+ idx_offset = units .index (offset_unit )
836+ res_unit = units [min (idx_self , idx_offset )]
834837 result = type (self )._simple_new (res_values , dtype = res_values .dtype )
835838 result = result .as_unit (res_unit )
836839
You can’t perform that action at this time.
0 commit comments