I have a data frame of say the share of sales for 3 products (millions of lines in real case) by country and I want the share of sales by continent for each product.

Data are like this one:

`df = pd.DataFrame({"fr": [.2, .1, .3], "ge": [.2, .2, .2], "uk": [.2, .3, .2], "us": [.2, .2, .1], "br": [.2, .2, .2]})`

And I have a table associating each country to a continent like this one:

`country = pd.DataFrame({"continent": ["Europe", "Europe", "Europe", "Europe", "Europe", "Americas", "Americas", "Americas", "Asia", "Asia"], "country": ["fr", "ge", "uk", "es", "pt", "us", "br", "ca", "cn", "jp"]})`

How can I do this simply?

I thought about transposing, merging, summing and transposing back but I guess there are simpler ways…

Thank you