pandas.DatetimeIndex.snap
pandas 3.1.1 · Index objects · method
Move each timestamp to the closest point on the specified frequency.
Call syntax
DatetimeIndex.snap(freq='S')Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
freq |
Optional Positional or keyword Default 'S' |
str, Timedelta, datetime.timedelta, or DateOffset Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start. |
Returns
DatetimeIndex