title: pandas: merge dataframes and include index as a column
body: <p>I have two dataframes like the following:</p>
  
  <pre><code>df1:
     dp  value
  0  d1      2
  1  d1      3
  2  d2      7
  3  d2      8
  4  d3      6
  
  df2:
    fv_name  dp  value
  0     x-1  d1      2
  1     x-2  d1      2
  2     x-3  d1      3
  3     x-1  d2      7
  4     x-2  d2      7
  5     x-3  d2      8
  6     x-1  d3      6
  7     x-2  d3      6
  8     x-3  d3      6
  </code></pre>
  
  <p>And I am trying to add the indices from df1 onto df2 to produce a dataframe that looks like the following:</p>
  
  <pre><code>df3:
    fv_name  dp  value   dp_id
  0     x-1  d1      2    0
  1     x-2  d1      2    0
  2     x-3  d1      3    1
  3     x-1  d2      7    2
  4     x-2  d2      7    2
  5     x-3  d2      8    3
  6     x-1  d3      6    4
  7     x-2  d3      6    4
  8     x-3  d3      6    4
  </code></pre>
  
  <p>I was attempting some different types of merges like the following, but I am unable to achieve my desired dataframe.</p>
  
  <pre><code>df3 = pd.merge(df1, df2, on=['dp', 'value'], how='outer')
  </code></pre>
  
  <p>Thanks in advance for any help with this.</p>