python pandas- merging two data frames based on an index order,df1['cumcount'] = df1.groupby('val1').cumcount()