pd.merge left_on code example Example: pandas merge sort columns result = df1.merge(df2, how='outer').sort_index(axis=1)