File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -824,12 +824,13 @@ def _add_offset(self, offset: BaseOffset) -> Self:
824824 "s" ,
825825 ]
826826 res_unit = self .unit
827- if hasattr (offset , "offset" ):
827+ if hasattr (offset , "offset" ) and offset . offset is not None :
828828 offset_td = Timedelta (offset .offset )
829- offset_unit = offset_td .unit
830- idx_self = units .index (self .unit )
831- idx_offset = units .index (offset_unit )
832- res_unit = units [min (idx_self , idx_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 )]
833834 result = type (self )._simple_new (res_values , dtype = res_values .dtype )
834835 result = result .as_unit (res_unit )
835836
You can’t perform that action at this time.
0 commit comments