i have 3 dataframe.
In the 1st one i have the price with id_share as columns
In the 2nd one i have the id_share and the currency of cotation
In the 3rd one i have the exchange rate with the currency name as column
My question is simple: how to convert the price with the exchange rate.
PS: of course, my original data has more columns in fund_price and rows df_fund_carac.
import pandas as pd
fund_price = pd.DataFrame({1 : [100, 100, 110, 120, 120],
2 : [100, 99, 101, 102, 103],
5 : [10, 10, 11, 10, 10]},
index= pd.date_range(start='2024-12-31', freq='B', periods=5),
)
fund_price.columns.name = 'id_share'
fund_price.index.name = 'date_price'
# Créez un dataframe à partir du dictionnaire
df_fund_carac = pd.DataFrame(
{
"id_share": [1, 2, 5],
"currency": ["EUR", "USD", "JPY"] }
)
fx_price = pd.DataFrame({'EUR' : [1, 1, 1, 1, 1],
'USD' : [1.00, .99, 1.01, 1.02, 1.03],
'JPY' : [100, 100, 110, 100, 100]},
index= pd.date_range(start='2024-12-31', freq='B', periods=5),
)
fx_price.columns.name = 'currency_base'
fx_price.index.name = 'date_price'