The ceil_date function takes a pandas Series of dates and returns a new Series with the dates rounded up to the next specified unit. Itβs more robust than the pandas ceil function, which does weird things with irregular frequencies like Month which are actually regular.
Parameters
Name
Type
Description
Default
idx
pd.Series or pd.DatetimeIndex
The idx parameter is a pandas Series or pandas DatetimeIndex object that contains datetime values. It represents the dates that you want to round down.
required
unit
str
The unit parameter in the ceil_date function is a string that specifies the time unit to which the dates in the idx series should be rounded down. It has a default value of βDβ, which stands for day. Other possible values for the unit parameter could be
'D'
Returns
Type
Description
pd.Series
The ceil_date function returns a pandas Series object containing datetime64[ns] values.
Examples
import pytimetk as tkimport pandas as pddates = pd.date_range("2020-01-01", "2020-01-10", freq="1H")dates