I have two data-frames where df1 looks like:
id Status Colour
1 On Blue
19 On Red
4 On Green
56 On Blue
df2 looks like
id Status
19 Off
4 Even
I am trying to replace the Status in df1 with the Status in df2 if the id is present in both data-frames so my resulting data-frame looks like:
id Status Colour
1 On Blue
19 Off Red
4 Even Green
56 On Blue
I can identify the field in df1 that I want to change using:
df1.loc[df1['id'].isin(df2['id']), 'Status'] = referenced date
But I can't see how to identify the field in df2 to pass to df1 (the part to the right of the above equals sign)
How can I do this?