I have two dataframes.
The first is individual game data, which looks similar to this:
Team1 Team2 Team1Score Team2Score Year
0 a g 100 90 2019
1 b h 90 100 2018
2 c i 95 105 2017
3 d j 100 115 2018
4 e k 105 100 2016
5 f l 120 130 2015
6 a f 100 115 2015
The second is team data for the year, which looks similar to this:
Team Rating Year
0 a 111 2019
1 g 108 2019
2 j 105 2018
3 l 98 2015
4 b 104 2018
5 f 120 2015
6 a 100 2015
I want to merge them so that it looks like this:
Team1 Team2 Team1Score Team2Score Year Team1Rating Team2Rating
0 a g 100 90 2019 111 108
1 b h 90 100 2018 104 NULL
2 c i 95 105 2017 NULL NULL
3 d j 100 115 2018 NULL 105
4 e k 105 100 2016 NULL NULL
5 f l 120 130 2015 120 98
6 a f 100 115 2015 100 120
I basically want to have the team ratings with the game data. I'm not sure how to approach this and what steps to take