I have two dataframes :
df1 = pd.DataFrame({'Merge_Pr': ['BKK_AOT', 'BKK_BFS', 'BKK_TG', 'HND_ANA'],
'UniqueName': ['PR1', 'PR2', 'PR3', 'PR18']})
df2 = pd.DataFrame(
{'Merge_Pr': ['BKK_AOT','BKK_AOT','BKK_BFS','BKK_TG','BKK_TG','HND_ANA','HND_ANA'],
'Quantity':[9240, 1433, 56779, 2230, 5560, 1004, 4553],
'Requisition_Number': ['NaN','NaN','NaN','NaN','NaN','NaN','NaN',]})
I would like to update the column Requisition_Number (df2) with PR number from the column UniqueName in (df1) by key column Merge_Pr.
I tried with merge but it adds a new column to df2 but what I want is to have the result in the existing column Requisition_Number so the desired output would be:
Merge_Pr Quantity Requisition_Number
0 BKK_AOT 9240 PR1
1 BKK_AOT 1433 PR1
2 BKK_BFS 56779 PR2
3 BKK_TG 2230 PR3
4 BKK_TG 5560 PR3
5 HND_ANA 1004 PR18
6 HND_ANA 4553 PR18
Thanks a lot for any suggestions