Finding consecutive segments in a pandas data frame,df.reset_index().groupby('A')['index'].apply(np.array)