Here is what my two dataframes look like:
DF1
NAME EMAIL ID
Mark mark@gmail.com 8974
Sam sam@gmail.com 9823
June june@gmail.com 0972
David david@gmail.com 2143
DF2
ID ROLE-ID
2143 22
0972 34
8974 98
9823 54
What I need to help doing:
I need to COMPARE the ID column for both dataframes and if the ID from DF1 MATCHES with the ID of DF2, I need to replace the ID column in DF1 with the respective ROLE-ID from DF2.
The output would look like this:
Updated DF1
NAME EMAIL ROLE-ID
Mark mark@gmail.com 98
Sam sam@gmail.com 54
June june@gmail.com 34
David david@gmail.com 22
I am using the Pandas library and tried the merge function with conditions but it didnt work
print(pd.merge(df1, df2, on=(df1['Id'] == df2[])))