I have the following data frame named df1:
CITY | V1 | V2 |
---|---|---|
A | 2 | 0 |
B | 6 | 4 |
C | 9 | 2 |
D | 8 | 2 |
E | 9 | 5 |
And also I have the following dataframe named df2:
CITY | X |
---|---|
C | 45 |
E | 9 |
How can I add the information from df2 to df1 based on city name? The desired outcome is:
CITY | V1 | V2 | X |
---|---|---|---|
A | 2 | 0 | NA |
B | 6 | 4 | NA |
C | 9 | 2 | 45 |
D | 8 | 2 | NA |
E | 9 | 5 | 9 |