Jan-21-2020, 11:22 AM
Dear all,
I have problems with a matrix search and calculation. This is my problem.
I have a df1 with different year values for each indicator and country.
I have a df2 with combinations of countries and yearly values.
The desired output is df3 where the product of the indicators fo the countires per year is created and calcualted.
These are the Dataframe:
Thank you.
Kidn regards
I have problems with a matrix search and calculation. This is my problem.
I have a df1 with different year values for each indicator and country.
I have a df2 with combinations of countries and yearly values.
The desired output is df3 where the product of the indicators fo the countires per year is created and calcualted.
These are the Dataframe:
df1 =pd.DataFrame({'Country':['Armenia','Azerbaidjan','Belarus','Armenia','Azerbaidjan','Belarus'],\ 'Indictaor':['G','G','G','H', 'H', 'H'],'2005':[3,4,5,6,7,4],'2006':[6,3,1,3,5,6]})
[python] df2 = pd.DataFrame({'Year':[2005,2006,2005,2006], 'Country1':['Armenia','Armenia','Azerbaidjan','Azerbaidjan'], 'Country2': ['Belarus','Belarus','Belarus','Belarus']})
df3 = pd.DataFrame({'Year':[2005,2006,2005,2006], 'Country2': ['Belarus','Belarus','Belarus','Belarus'], 'Country1':['Armenia','Armenia','Azerbaidjan','Azerbaidjan'], 'IndictaorGProduct':[15,6,35,5], 'IndictaorHProduct':[24,18,28,30]})I am extremly thankful if someone could help with this problem as this is really confusing.
Thank you.
Kidn regards