modin.pandas.TimedeltaIndex.as_unit

TimedeltaIndex.as_unit(unit: str) TimedeltaIndex[source]

Convert to a dtype with the given unit resolution.

Parameters:

unit ({'s', 'ms', 'us', 'ns'}) –

Return type:

DatetimeIndex

Examples

>>> idx = pd.to_timedelta(['1 day 3 min 2 us 42 ns'])  
>>> idx  
TimedeltaIndex(['1 days 00:03:00.000002042'],
                dtype='timedelta64[ns]', freq=None)
>>> idx.as_unit('s')  
TimedeltaIndex(['1 days 00:03:00'], dtype='timedelta64[s]', freq=None)
Copy