I have a dataframe "df1" that look like this:
| company id | company name | dealid_1 | dealyear_1 | dealid_2 | dealyear_2 |
|---|---|---|---|---|---|
| C1 | ABC | ||||
| C2 | DEF |
Where I want to fill the blank cells with data from another dataframe "df2" which looks like this:
| deal id | deal year | company id | company name |
|---|---|---|---|
| D1 | 2010 | C1 | ABC |
| D2 | 2015 | C1 | ABC |
| D3 | 2012 | C2 | DEF |
| D4 | 2017 | C2 | DEF |
So the final result for "df1" should be as follows:
| company id | company name | dealid_1 | dealyear_1 | dealid_2 | dealyear_2 |
|---|---|---|---|---|---|
| C1 | ABC | D1 | 2010 | D2 | 2015 |
| C2 | DEF | D3 | 2012 | D4 | 2017 |
Can anyone please help me with this?
Thank you!