title: How to do left join two dataframes with varying lengths based on the nearest timestamp in python and not lose any rows?
body: <p>I would like to merge two dataframes based on timestamps. The timestamps are not exactly the same in both the dataframes. I want to merge the right dataframe with the left one based on the closest timestamp and have NaN wherever the timestamp is out of the tolerance limit. If i use pandas asof(), i lose all the rows that are out of the tolerance limit.</p>
  <pre><code>    df_left['timestamp'] = [1.1, 2.1, 3.1, 4.1, 5.1]
      df_left['value1'] = [10, 20, 30, 10, 30]
  
      df_right['timestamp'] = [1.05, 2.2, 4.1, 5.12]
      df_right['value2'] = [200, 400, 500, 200]
  
      
  </code></pre>
  <p>Wanted output:</p>
  <pre><code>    df_merged['timestamp'] = [1.1, 2.1, 3.1, 4.1, 5.1]
      df_merged['value1'] = [10, 20, 30, 10, 30]
      df_merged['value2'] = [200, 400, NaN, 500, 200]
  </code></pre>