modin.pandas.TimedeltaIndex.as_unit

TimedeltaIndex.as_unit(unit: str) TimedeltaIndex[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/timedelta_index.py#L450-L471)

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
Language: English