0

I need to compare dataframe A and dataframe B to update two columns on dataframe A. For example: A_df:

employee  status 1  status 2 
A1         AB        CD       
B1         AB        DC       
C1         BA        DC     
D1         BA        DC      

B_df:

employee  status 1  status 2
A1         AB        CD       
B1         AB        DC       
C1         BA        CD       

Desired output: A_df

employee  status 1  status 2 
A1         AB        CD       
B1         AB        DC       
C1         BA        CD       
D1         BA        DC       

I've tried following.

A_df["status 1"] = B_df["status 1"]
A_df["status 2"] = B_df["status 2"]

And then, got following

employee  status 1  status 2 
A1         AB        CD       
B1         AB        DC       
C1         BA        CD    
D1         NaN       NaN  
inate
  • 1
  • the answer you want is in the link I posted, just know that when you use drop duplicates, you can specify to keep the first or last record, and that will matter depending on the order of the concatenation. – Chris Nov 29 '22 at 14:32

0 Answers0