I have the following two data frames in pandas:
df1
name | id |
---|---|
A_0 | B_0 |
A_1 | B_1 |
A_0 | B_2 |
and df2
name | data0 | data1 |
---|---|---|
A_0 | C_0 | D_0 |
A_1 | C_1 | D_1 |
And I would like to merge them so the data frame is in the following way (Merge the ones that have the same ID and append their data)
name | id | data0 | data1 |
---|---|---|---|
A_0 | B_0 | C_0 | D_0 |
A_1 | B_1 | C_1 | D_1 |
A_0 | B_2 | C_0 | D_0 |
How would I be able to merge them this way? I have been reading this page but I can't seem to find the option that would do this