pandas.TimedeltaIndex.ceil#
- TimedeltaIndex.ceil(freq, ambiguous='raise', nonexistent='raise')[source]#
Perform ceil operation on the data to the specified freq.
This method rounds each timedelta value in the Series/Index up to the specified frequency (i.e., towards positive infinity).
- Parameters:
- freqstr or Offset
The frequency level to ceil the index to. Must be a fixed frequency like ‘s’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.
- ambiguous‘infer’, bool-ndarray, ‘NaT’, default ‘raise’
Accepted for compatibility with
DatetimeIndex.ceil(); has no effect since TimedeltaIndex values are never tz-aware.- nonexistent‘shift_forward’, ‘shift_backward’, ‘NaT’, timedelta, default ‘raise’
Accepted for compatibility with
DatetimeIndex.ceil(); has no effect since TimedeltaIndex values are never tz-aware.
- Returns:
- TimedeltaIndex
Values rounded up to the given freq.
- Raises:
- ValueError if the freq cannot be converted.
See also
TimedeltaIndex.roundPerform round operation on the data to the specified freq.
TimedeltaIndex.floorPerform floor operation on the data to the specified freq.
Examples
>>> tdelta_idx = pd.timedelta_range("1 day", periods=3, freq="6h20min") >>> tdelta_idx TimedeltaIndex(['1 days 00:00:00', '1 days 06:20:00', '1 days 12:40:00'], dtype='timedelta64[us]', freq='380min') >>> tdelta_idx.ceil("h") TimedeltaIndex(['1 days 00:00:00', '1 days 07:00:00', '1 days 13:00:00'], dtype='timedelta64[us]', freq=None)