one week, optionally anchored on a day of the week
WeekOfMonth
the x-th day of the y-th week of each month
LastWeekOfMonth
the x-th day of the last week of each month
MonthEnd
calendar month end
MonthBegin
calendar month begin
BMonthEnd
business month end
BMonthBegin
business month begin
CBMonthEnd
custom business month end
CBMonthBegin
custom business month begin
SemiMonthEnd
15th (or other day_of_month) and calendar month end
SemiMonthBegin
15th (or other day_of_month) and calendar month begin
QuarterEnd
calendar quarter end
QuarterBegin
calendar quarter begin
BQuarterEnd
business quarter end
BQuarterBegin
business quarter begin
FY5253Quarter
retail (aka 52-53 week) quarter
YearEnd
calendar year end
YearBegin
calendar year begin
BYearEnd
business year end
BYearBegin
business year begin
FY5253
retail (aka 52-53 week) year
BusinessHour
可以自己设置工作时间
CustomBusinessHour
custom business hour
Hour
one hour
Minute
one minute
Second
one second
Milli
one millisecond
Micro
one microsecond
Nano
one nanosecond
from pandas.tseries.offsets import *
d = datetime(2008, 8, 18, 9, 0)
In [106]: d + DateOffset(months=4, days=5)
Out[106]: Timestamp('2008-12-23 09:00:00')
In [107]: d - 5 * BDay()
Out[107]: Timestamp('2008-08-11 09:00:00')
In [108]: d + BMonthEnd()
Out[108]: Timestamp('2008-08-29 09:00:00')
In [109]: d
Out[109]: datetime.datetime(2008, 8, 18, 9, 0)
In [110]: offset = BMonthEnd()
In [111]: offset.rollforward(d)
Out[111]: Timestamp('2008-08-29 09:00:00')
In [112]: offset.rollback(d)
Out[112]: Timestamp('2008-07-31 09:00:00')