I'm trying to join 2 dataframes in a kind of strange way and was wondering if anyone has any advice.
My first data frame looks like this, call it df1
:
2nd one looks like, call it df2
:
I want my final output to merge each team's stats next to their respective names in the games dataframe. A brute force way I thought of doing this was to change the name of the TEAM
column in df1
to Home
, join it on that. Then, change the TEAM
column to Visitor
and join it on that too but I feel their should be an easier way. Can anyone give me advice on this, thanks!