![]() |
VOOZH | about |
The dt.ceil() method performs ceil operation on the data to the specified frequency.
Output:
Syntax: Series.dt.ceil(freq, ambiguous='raise', nonexistent='raise')
Parameter:
- freq: The frequency level to ceil the index to
- ambiguous: Only relevant for DatetimeIndex. βinferβ will attempt to infer fall dst-transition hours based on order
- nonexistent: A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.
Returns: DatetimeIndex, TimedeltaIndex, or Series
To round up the DateTime to the nearest specified frequency we use the dt.ceil method of the Pandas library in Python.
Let us understand it better with an example:
Use the dt.ceil() function to ceil the DateTime data of the given series object to the specified frequency.
Output :
Now we will use the dt.ceil() function to ceil the datetime values in the given series object to Hourly frequency.
Output :
As we can see in the output, the Pandas dt.ceil() function has successfully ceiled the DateTime values in the given series object to the specified frequency.