Pandas, merging two dataframes on multiple columns, and multiplying result
You could merge and them multiply:
merged = df1.merge(df2, on=['Name', 'Event'])
merged['ResultFactor'] = merged.Factor1 * merged.Factor2
result = merged.drop(['Factor1', 'Factor2'], axis=1)
print(result)
Output
Name Event ResultFactor
0 John A 2.4
1 John B 1.5
2 Ken A 3.0
df = pd.merge(left=df1, right=df2, on=['Name','Event'], how='inner']
df['FactorResult'] = df['Factor1'] * df['Factor2']
df = df[['Name', 'Event', 'FactorResult']]
If your dataframes are identically labelled, you don't need to merge,
(df1.set_index(['Name', 'Event'])['Factor1'] * df2.set_index(['Name', 'Event'])['Factor2']).reset_index(name = 'FactorResult')
Name Event FactorResult
0 John A 2.4
1 John B 1.5
2 Ken A 3.0