title: Merging on non-unique column - pandas python
body: <p>I have been trying to merge two <code>DataFrames</code> together (<code>df</code> and <code>df_details</code>) in a similar fashion to an Excel "vlookup" but am getting strange results. Below I show the structure of the two <code>DataFrames</code> without populating real data for simplicity</p>
  
  <pre><code>df_details:
  
  Abstract_Title  |  Abstract_URL  |  Session_No_v2  | Session_URL | Session_ID
    -------------------------------------------------------------------------
  Abstract_Title1    Abstract_URL1         1          Session_URL1     12345
  Abstract_Title2    Abstract_URL2         1          Session_URL1     12345
  Abstract_Title3    Abstract_URL3         1          Session_URL1     12345
  Abstract_Title4    Abstract_URL4         2          Session_URL2     22222 
  Abstract_Title5    Abstract_URL5         2          Session_URL2     22222
  Abstract_Title6    Abstract_URL6         3          Session_URL3     98765
  Abstract_Title7    Abstract_URL7         3          Session_URL3     98765
  
  df:
  
  Session_Title   |   Session_URL   |   Sponsors   |    Type    |   Session_ID
      -------------------------------------------------------------------------------
  Session_Title1     Session_URL1        x, y z     Paper             12345
  Session_Title2     Session_URL2         x, y      Presentation      22222
  Session_Title3     Session_URL3        a, b ,c    Presentation      98765
  Session_Title4     Session_URL4          c        Talk              12121
  Session_Title5     Session_URL5         a, x      Paper             33333
  </code></pre>
  
  <p>I want to merge along <code>Session_ID</code> and I want the final <code>DataFrame</code> to look like:
  <a href="https://i.stack.imgur.com/2tyD8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2tyD8.png" alt="enter image description here"></a></p>
  
  <p>I've tried the following script which yields a <code>DataFrame</code> that duplicates (several times) certain rows and does strange things. For example, <code>df_details</code> has 7,046 rows and <code>df</code> has 1,856 rows - when I run the following merge code, my <code>final_df</code> results in 21,148 rows:</p>
  
  <pre><code>final_df = pd.merge(df_details, df, how = 'outer', on = 'Session_ID')
  </code></pre>
  
  <p>Please help!</p>