modin.pandas.DatetimeIndex.as_unit¶
- DatetimeIndex.as_unit(unit: str) DatetimeIndex [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/datetime_index.py#L1418-L1438)¶
Convert to a dtype with the given unit resolution.
- Parameters:
unit ({'s', 'ms', 'us', 'ns'}) –
- Return type:
same type as self
Examples
>>> idx = pd.DatetimeIndex(['2020-01-02 01:02:03.004005006']) >>> idx DatetimeIndex(['2020-01-02 01:02:03.004005006'], dtype='datetime64[ns]', freq=None) >>> idx.as_unit('s') DatetimeIndex(['2020-01-02 01:02:03'], dtype='datetime64[s]', freq=None)