pd.merge(pd.melt(df1, id_vars='ID'), df2, left_on=['variable', 'value'],
    right_on=['parameter', 'value']).pivot('ID', 'parameter', 'weight')
Using column header and values from one dataframe to find weights in another dataframe