I'm stumped on how to merge df with df1 for the final output (see below). I have tried pd.merge on each of the columns individually 1 time each for a total of 3 times. Before doing a pd.merge, I change the column header to ID1, ID2 or ID2. Finally, if all values in the ID columns are NaN after trying to merge, then I will append that row of data. I'm wondering if there is a simpler way to do this.
EDIT: One rule is you cannot merge on the Account field. In my actual data, sometimes the Account fields are slightly different in the two dataframes, so I must merge on the ID field!
df:
Account ID1 ID2 ID3 Revenue
0 A 123 789 567 900
1 B 321 234 213 400
2 C 456 700
df1:
Account Industry ID
0 A Tech 123
1 B Retail 213
2 D Legal 111
output:
Account Industry ID Revenue
0 A Tech 123 900
1 B Retail 213 400
2 C 456 700
3 D Legal 111 0