how to interpolate period into dates based on 2 dataframe in python

Viewed 62

I have 2 dataframe df1 as below:

df1:
  PriceDate         Term_By_Day    ccr          Mid_Spread
0       01/07/2019   365          AUD-USD        0.011745  
1       01/07/2019   730          USD-EUR        0.027624
2       01/07/2019   1825         AUD-USD        0.244957 
3      01/07/2019     30          AUD-USD        0.012500
4       01/07/2019    60          Eur-USD        0.007353

and df2 as below:

df2:
 PriceDate         tenor    ccr          
0       01/07/2019   180          AUD-USD       
1       01/07/2019   182          USD-EUR     
2       01/07/2019   183         AUD-USD      
3      01/07/2019    185         AUD-USD       
4       01/07/2019    186         Eur-USD 

As you can see, df1 is the data out of BBG which has all other columns based on period (1month, 1 year, 2 year, 5 year,...) however df2 is based on detailed dates for each month ( at least 15 days of each month). i need to interpolate df1 to be fit based on all detailed date instead of period. then attach df1 to df2 to calculate "midspread".

for example if i have 180 days and 270 days in "term by day" in df1 then i would have many days in "tenor" between 180 days and 270 days.

can you please help me what's the best way to get accurate and fast interpolation ?

Many thanks in advance for taking your time

Cheers, Z

0 Answers
Related