title: How to compare 2 Pandas dataframes and add a new column based on comparison
body: <p>I have two dataframes that require comparing the ticket_id column. If there is a match, I need to add a column to the first dataframe that comes from a column from the second dataframe. If there is no match between the first dataframe and second dataframe, then that means there is a new row in the second dataframe that needs to be added to the first.</p>
  
  <p>I have tried using if statements but have unsuccessfully been able to compare them.</p>
  
  <p>df_A (current week help desk ticket report)</p>
  
  <pre><code>ticket_id   category   submitted  closed   status   
  1           critical   4/20/19    5/1/19   closed
  2           low        4/23/19    5/2/19   closed
  3           medium     4/26/19             open
  4           low        5/1/19              open
  </code></pre>
  
  <p>df_B (previous week help desk ticket report)</p>
  
  <pre><code>ticket_id   category   submitted  closed   status   
  1           critical   4/20/19             open
  2           low        4/23/19             open
  3           medium     4/26/19             open
  </code></pre>
  
  <p>So I essentially want to make a new dataframe based on df_A but take the previous week status for that ticket ID and add it to the new dataframe as the last column. If a new ticket appears from previous week to new week (i.e. ticket_id = 4) then it should be appended and there should be a status of NA or blank (doesn't really matter).</p>
  
  <p>expected df_A</p>
  
  <pre><code>ticket_id   category   submitted  closed   status  previous_week_status  
  1           critical   4/20/19    5/1/19   closed  open
  2           low        4/23/19    5/2/19   closed  open
  3           medium     4/26/19             open    open
  4           low        5/1/19              open    NA
  </code></pre>