Let's say I have data similar to the following: df:
Student | Week 1 Grade |
---|---|
John | 93 |
Sally | 72 |
James | 93 |
Jim | 72 |
df1:
Student | Week 2 Grade |
---|---|
John | 87 |
James | 93 |
Jim | 72 |
I want to merge these two, and I figure I should use an outer join, but this is what I'm getting:
Student | Week 1 Grade | Student | Week 2 Grade |
---|---|---|---|
John | 93 | John | 87 |
Sally | 72 | James | 93 |
James | 93 | Jim | 72 |
Jim | 72 | NaN | NaN |
This is what I'd like to get:
Student | Week 1 Grade | Week 2 Grade |
---|---|---|
John | 93 | 87 |
Sally | 72 | NaN |
James | 93 | 93 |
Jim | 72 | 72 |
The ordering of Student varies in each DataFrame, and there are some names in df that are not present in df1.
Thanks for your help!