title: Pandas: Merge on exact ID and closest date
body: <p>I'm trying to merge two Pandas dataframes on two columns.  One column has a unique identifier that could be used to simply <code>.merge()</code> the two dataframes.  However, the second column merge would actually use <code>.merge_asof()</code> because it would need to find the <em>closest</em> date, not an exact date match.</p>
  
  <p>There is a similar question here: <a href="https://stackoverflow.com/questions/24614474/pandas-merge-on-name-and-closest-date">Pandas Merge on Name and Closest Date</a>, but it was asked and answered nearly three years ago, and <code>merge_asof()</code> is a much newer addition.  </p>
  
  <p>I asked a similar <a href="https://stackoverflow.com/questions/41317051/pandas-find-nearest-dates-between-two-dataframes-without-loop">here</a> question a couple months ago, but the solution only needed to use <code>merge_asof()</code> without any exact matches required.</p>
  
  <p>In the interest of including some code, it would look something like this:</p>
  
  <p><code>df = pd.merge_asof(df1, df2, left_on=['ID','date_time'], right_on=['ID','date_time'])</code></p>
  
  <p>where the <code>ID</code>'s will match exactly, but the <code>date_time</code>'s will be "near matches".</p>
  
  <p>Any help is greatly appreciated.</p>