Perform function on pairs of rows in Pandas dataframe,g = df.groupby(df.index // 2)