I am looking to add another column to DF1
below which returns the population of the relevant country for the year of the observation. I.e when country and year match with DF2
, population is added to a column in DF2
. I have used merge
for matching only one variable before, is there a method to complete for two variables?
DF1:
eventid |iyear | imonth| iday | CountryTxt
1.97000e+1 |1970 | 7| 2 | Albania
1.97000e+11| 1970| 0| 0 | United Kingdom
1.97001e+11| 1984| 1| 0 | Somalia
1.97001e+11| 1990| 1| 0 | France
1.97001e+11| 1991| 1| 0 | New Zealand
DF2:
Country.Name|Code|Year|Population
Aruba |ABW |1960| 123
Afganistan |AFG |1970| 456
Albania |ALB |1970| 1000
France |FRA |1990| 5000