get last N rows RELATIVE to another row in pandas
    http://stackoverflow.com/questions/25724056/how-to-get-last-n-rows-relative-to-another-row-in-pandas-vector-solution

def multi_shift(df, window):
    """
    get last N rows RELATIVE to another row in pandas
    http://stackoverflow.com/questions/25724056/how-to-get-last-n-rows-relative-to-another-row-in-pandas-vector-solution
    """
    if isinstance(df, pd.Series):
        df = pd.DataFrame(df)

    dfs = [df.shift(i) for i in np.arange(window)]
    for ix, df_item in enumerate(dfs[1:]):
        dfs[ix + 1].columns = [str(col) for col in df_item.columns + str(ix + 1)]
    return pd.concat(dfs, 1, sort=True)