Example
s=pd.Series([5,4,3,2,1], index=[1,2,3,4,5]) print s 1 5 2 4 3 3 4 2 5 1
Is there an efficient way to create a serie
For a dataframe df with the lag to be applied on 'col name', you can use the shift function.
df['lag1']=df['col name'].shift(1) df['lag2']=df['col name'].shift(2)