reindex sublevel of pandas dataframe multiindex,df['Measurements'] = df.reset_index().groupby('Trial').cumcount()