xarray.CFTimeIndex.shift#
- CFTimeIndex.shift(periods, freq=None)[source] #
Shift the CFTimeIndex a multiple of the given frequency.
See the documentation for
date_range()for a complete listing of valid frequency strings.- Parameters:
periods (
int,float if freqofdaysorbelow) – Periods to shift byfreq (
str,datetime.timedeltaorBaseCFTimeOffset) – A frequency string or datetime.timedelta object to shift by
- Returns:
See also
pandas.DatetimeIndex.shiftExamples
>>> index = xr.date_range("2000", periods=1, freq="ME", use_cftime=True) >>> index CFTimeIndex([2000年01月31日 00:00:00], dtype='object', length=1, calendar='standard', freq=None) >>> index.shift(1, "ME") CFTimeIndex([2000年02月29日 00:00:00], dtype='object', length=1, calendar='standard', freq=None) >>> index.shift(1.5, "24h") CFTimeIndex([2000年02月01日 12:00:00], dtype='object', length=1, calendar='standard', freq=None)