I have 2 data frames: In each data frame i have column with the same name and values (Key_Merge1) and in each data frame i have 2 different column names with same values (Key_Merge2). How can i merge 2 data frames by 2 columns: 1. By Key Merge1 2. By Key Merge21 (DF1) and Key Merge22 (DF2)
DF1
PRODUCT PARAMETER_NAME PARAMETER VALUE1 PARAMETER_VALUE2 PARAMETER_VALUE_3
AAA PARAM1 10 10 10
AAA PARAM2 11 11 11
BBB PARAM1 12 12 12
BBB PARAM2 12 12 12
DF2
PRODUCT_GROUP PARAMETER_NAME Limit1 Limit2 Limit3
AAA PARAM1 22 24 26
AAA PARAM2 32 34 36
BBB PARAM1 42 44 46
BBB PARAM2 52 54 56
DF1+DF2
PRODUCT PARAMETER_NAME PARAMETER VALUE1 PARAMETER_VALUE2 PARAMETER_VALUE_3 Limit1 Limit2 Limit3
AAA PARAM1 10 10 10 22 24 26
AAA PARAM2 11 11 11 32 34 36
BBB PARAM1 12 12 12 42 44 46
BBB PARAM2 12 12 12 52 54 56
Thank you
pd.merge(df1, df2, left_on=['Key_Merge1', 'Key_Merge21'], right_on=['Key_Merge1', 'Key_merge22'])
– EdChum