modin.pandas.DatetimeIndex.snap¶
- DatetimeIndex.snap(freq: Frequency = 'S') DatetimeIndex [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/datetime_index.py#L942-L959)¶
Snap time stamps to nearest occurring frequency.
- Return type:
Examples
>>> idx = pd.DatetimeIndex(['2023-01-01', '2023-01-02', ... '2023-02-01', '2023-02-02']) >>> idx DatetimeIndex(['2023-01-01', '2023-01-02', '2023-02-01', '2023-02-02'], dtype='datetime64[ns]', freq=None) >>> idx.snap('MS') DatetimeIndex(['2023-01-01', '2023-01-01', '2023-02-01', '2023-02-01'], dtype='datetime64[ns]', freq=None)