title: How to efficiently search between two dataframes in python pandas?
body: <p>i have two dataframes (in pandas)</p>
  <p>df1:</p>
  <pre><code>logged_at, item, value
  2021-01-03 20:01:23, A, 4
  2021-01-03 20:01:24, A, 5
  2021-01-03 20:01:25, B, 4
  2021-01-03 20:01:26, B, 7
  2021-01-03 20:01:27, A, 10
  </code></pre>
  <p>df2:</p>
  <pre><code>id, start_time, end_time, item
  2, 2021-01-03 20:01:00, 2021-01-03 20:05:33, A
  3, 2021-01-03 20:01:11, 2021-01-03 21:44:12, B
  </code></pre>
  <p>i want new dataframe like
  new_df:</p>
  <pre><code>logged_at, item, value, id
  2021-01-03 20:01:23, A, 4, 2
  2021-01-03 20:01:24, A, 5, 2
  2021-01-03 20:01:25, B, 4, 3
  2021-01-03 20:01:26, B, 7, 3
  2021-01-03 20:01:27, A, 10, 2
  </code></pre>
  <p>What I want is to attach the ID of df2 to the column of df1.</p>
  <p>The condition is that the logged_at time of df1 exists between the start_time and the end_time of df2.</p>
  <p>The number of data in df1 exceeds 900,000 and the number of data in df2 exceeds 100,000.</p>
  <p>It takes too long to attach each row of df1.</p>
  <p>Is there an efficient way?</p>