lag the datain [ ]ts shift( freq=' 'out[ ] in [ ]ts shift( freq=' 'out[ ] in [ ]ts shift( freq=' 'out[ ] : : : : : : : : shifting dates with offsets the pandas date offsets can also be used with datetime or timestamp objectsin [ ]from pandas tseries offsets import daymonthend in [ ]now datetime( in [ ]now day(out[ ]datetime datetime( if you add an anchored offset like monthendthe first increment will roll forward date to the next date according to the frequency rulein [ ]now monthend(out[ ]datetime datetime( in [ ]now monthend( out[ ]datetime datetime( anchored offsets can explicitly "rolldates forward or backward using their rollfor ward and rollback methodsrespectivelyin [ ]offset monthend(in [ ]offset rollforward(nowout[ ]datetime datetime( in [ ]offset rollback(nowout[ ]datetime datetime( clever use of date offsets is to use these methods with groupbyin [ ]ts series(np random randn( )index=pd date_range(''periods= freq=' ')in [ ]ts groupby(offset rollforwardmean(out[ ]- time series www it-ebooks info