pandas.DatetimeIndex.floor
pandas 3.1.1 · Index objects · method
Round timestamps or durations down to a frequency boundary.
Call syntax
DatetimeIndex.floor(freq, ambiguous='raise', nonexistent='raise')Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
freq |
Required Positional or keyword |
str or Offset Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start. |
ambiguous |
Optional Positional or keyword Default 'raise' |
'infer', bool-ndarray, 'NaT' Resolve local times that occur twice when clocks move backward. |
nonexistent |
Optional Positional or keyword Default 'raise' |
'shift_forward', 'shift_backward', 'NaT', timedelta Resolve local times skipped when clocks move forward. |
Returns
DatetimeIndex