merge dataframe by index code example Example: merge on index pandas pd.merge(df1, df2, left_index=True, right_index=True)