datatable.shift()¶
Produce a column obtained from col shifting it n rows forward.
The shift amount, n, can be both positive and negative. If positive,
a “lag” column is created, if negative it will be a “lead” column.
The shifted column will have the same number of rows as the original
column, with n observations in the beginning becoming missing, and
n observations at the end discarded.
This function is group-aware, i.e. in the presence of a groupby it will perform the shift separately within each group.