pandas asof join code example Example: pandas merge_asof direction pd.merge_asof(df1, df2, on='col', direction='nearest')