I have two Excel files, say, wb1.xlsx and wb2.xlsx.
wb1.xlsx
adsl svc_no port_stat adsl.1 Comparison result
2/17
2/24
2/27
2/33
2/37
3/12
wb2.xlsx
caller_id status adsl Comparison result
n/a SP 2/37 Not Match
n/a RE 2/24 Not Match
n/a SP 2/27 Match
n/a SP 2/33 Not Match
n/a SP 2/17 Match
What I want to do is match the adsl of wb2.xlsx to wb1.xlsx and get the other values to the other columns.
My expected output is to update wb1.xlsx with the values from wb2.xlsx
adsl svc_no port_stat adsl.1 Comparison result
2/17 n/a SP 2/17 Match
2/24 n/a RE 2/24 Not Match
2/27 n/a SP 2/27 Match
2/33 n/a SP 2/33 Not Match
2/37 n/a SP 2/37 Not Match
3/12
Upon searching, I was able to check that pd.merge() is able to do the matching.
I tried it this way:
result = pd.merge(df2, pri_df, on=['adsl', 'adsl'])
Unfortunately, it creates new columns and do not update the existing. Also, it only gets the values that it was able to matched and disregard the other rows.
I also tried to get the indices of the columns in wb2.xlsx and assigned it to the columns wb1.xlsx but it just copied it literally.
Any reference that would help will do.