title: How to conditionally do a vlookup in Pandas dataframe
body: <p>I am trying to figure out how to do a vlookup to pick out the latest price to fill up a second table. An example below. For item #1, the latest price is at Month <code>6 (=$6)</code> while item #2 is at Month <code>5 (=$4)</code>. What's the best way to fill up Table B? Note: There might be occasion that <code>item_id</code> cannot be found in Table A if the item is new.</p>
  
  <p>Any guidance? Many Thanks.</p>
  
  <p>Table A (Reference)</p>
  
  <pre><code>| Item_ID | Month | Price |
  |---------|-------|-------|
  | 1       | 4     | 10    |
  | 1       | 5     | 8     |
  | 1       | 6     | 6     |
  | 2       | 5     | 4     |
  </code></pre>
  
  <p>Table B (To Fill)</p>
  
  <pre><code>| Shop_ID | Item_ID | Price |
  |---------|---------|-------|
  | 1       | 1       | 6     |
  | 1       | 2       | 4     |
  </code></pre>