VOOZH about

URL: https://www.geeksforgeeks.org/pandas/pandas-series-dt-ceil/

⇱ Pandas Series dt.ceil | Ceil DateTime To Specified Frequency - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Pandas Series dt.ceil | Ceil DateTime To Specified Frequency

Last Updated : 11 Jul, 2025

The dt.ceil() method performs ceil operation on the data to the specified frequency.

Example

Output:

πŸ‘ dt.ceil output

Syntax

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

How to Round Up DateTime to Nearest Specified Frequency

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:

Example:

Use the dt.ceil() function to ceil the DateTime data of the given series object to the specified frequency.

Output :

πŸ‘ datetime series created

Now we will use the dt.ceil() function to ceil the datetime values in the given series object to Hourly frequency.

Output :

πŸ‘ ceil operation performed

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.

Comment

Explore