pandas merge with tolerance code example Example: pandas merge_asof direction pd.merge_asof(df1, df2, on='col', direction='nearest')