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