![]() |
VOOZH | about |
The dt.floor() method performs floor operation on the data to the specified frequency.
This is useful when we want to round down the DateTime data to a specific frequency level, such as hourly (‘H’), daily (‘D’), monthly (‘M’), etc.
Output:
Syntax: Series.dt.floor(floor)
Parameter
- freq : The frequency level to floor the index to
Returns: DatetimeIndex, TimedeltaIndex, or Series
To round down DateTime objects in Pandas Series to a specified frequency we use the Series.dt.floor method of the Pandas library in Python.
Let us understand it better with an example:
Use the Series dt.floor() function to floor the DateTime data of the given Series object to the specified frequency.
Output
Output :
👁 datetime data after dt.floor method
As we can see in the output, the Series.dt.floor() function has successfully floored the DateTime values in the given series object to the specified frequency.