File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -825,14 +825,17 @@ def _add_offset(self, offset: BaseOffset) -> Self:
825825 "s" ,
826826 ]
827827 res_unit = self .unit
828- if hasattr (offset , "offset" ) and offset .offset is not None :
829- if not isinstance (offset , TSeriesDateOffset ):
830- offset_td = Timedelta (offset .offset )
831- if offset_td .value != 0 :
832- offset_unit = offset_td .unit
833- idx_self = units .index (self .unit )
834- idx_offset = units .index (offset_unit )
835- res_unit = units [min (idx_self , idx_offset )]
828+ if isinstance (offset , TSeriesDateOffset ):
829+ micro = offset .kwds .get ("microseconds" , 0 )
830+ if micro and self .unit != "ns" :
831+ res_unit = "us"
832+ elif hasattr (offset , "offset" ) and offset .offset is not None :
833+ offset_td = Timedelta (offset .offset )
834+ if offset_td .value != 0 :
835+ offset_unit = offset_td .unit
836+ idx_self = units .index (self .unit )
837+ idx_offset = units .index (offset_unit )
838+ res_unit = units [min (idx_self , idx_offset )]
836839 result = type (self )._simple_new (res_values , dtype = res_values .dtype )
837840 result = result .as_unit (res_unit )
838841
You can’t perform that action at this time.
0 commit comments