how to set new dataframe index to another dataframes index pandas code example Example: use the index of a dataframe for another dataframe df2 = pd.DataFrame(df2,index=df1.index)