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