Hi@akhtar,
You can use Pandas.merge() function to merge your DataFrame. I have attached one example below for your reference.
import pandas as pd
df1 = pd.DataFrame({"HPI":[80,90,70,60],"Int_Rate":[2,1,2,3], "IND_GDP":[50,45,45,67]}, index=[2001, 2002,2003,2004])
| HPI |
Int_Rate |
IND_GDP |
| 2001 |
80 |
2 |
50 |
| 2002 |
90 |
1 |
45 |
| 2003 |
70 |
2 |
45 |
| 2004 |
60 |
3 |
67 |
df2 = pd.DataFrame({"HPI":[80,90,70,60],"Int_Rate":[2,1,2,3],"IND_GDP":[50,45,45,67]}, index=[2005, 2006,2007,2008])
| HPI |
Int_Rate |
IND_GDP |
| 2005 |
80 |
2 |
50 |
| 2006 |
90 |
1 |
45 |
| 2007 |
70 |
2 |
45 |
| 2008 |
60 |
3 |
67 |
merged= pd.merge(df1,df2,on ="HPI")
| HPI |
Int_Rate_x |
IND_GDP_x |
Int_Rate_y |
IND_GDP_y |
| 0 |
80 |
2 |
50 |
2 |
50 |
| 1 |
90 |
1 |
45 |
1 |
45 |
| 2 |
70 |
2 |
45 |
2 |
45 |
| 3 |
60 |
3 |
67 |
3 |
67 |