I have two dataframes like below , df1 and df2 has many columns , reduced it for better readability
df1 df2
id A B C ID A
1 x y z 1 m1
2 x1 y1 z1 2 m2
3 x2 y2 z2
Requirement is to fill up column A of df2 using a function where df1.id == df2.ID , lets this function be function1
input function1(x,y,z) output return m1.
input function1(x1,y1,z1) output return m2.
basically I have to use the function1 to fill the column A in df2 and where df1.id == df2.ID , in the function i have to send out the values from the 3 columns of df1
I was trying like below
df2['A'] = df1.loc[df1['id'] == df2['ID'],function1(df1['A'],df1['B'],df1['C'])]
but its not working , obviously function is not designed for columns as input , any suggestions?