Say I have the following DataFrame df1:
name course yob city
paul A 1995 london
john A 2005 berlin
stacy B 2015 vienna
mark D 2013 madrid
And also the following DataFrame df2:
name height occupation
paul 185 student
mark 162 pilot
I want to combine them to obtain:
name course height occupation yob city
paul A 185 student 1995 london
john A NaN NaN 2005 berlin
stacy B NaN NaN 2015 vienna
mark D 162 pilot 2013 madrid
So the idea is I have df1, which is my main data structure, and I want to insert the columns of df2 (which only has information regarding some of the names) in a specific location in df1 (namely in this case between the columns course and yob). The ordering of the columns is important, and shouldn't be changed.
What would be the most straightforward/elegant way of doing this?