use index column of dataframe in another code example Example: use the index of a dataframe for another dataframe df2 = pd.DataFrame(df2,index=df1.index)