title: Pandas- how to do merge on multiple columns including index
body: <p>I want to perform a merge in pandas on more than one column, where one of the columns is an index column.</p>
  
  <p>Here are example dataframes:</p>
  
  <pre><code>    df1 = pd.DataFrame(np.random.rand(4,4), columns=list('ABCD'))
      df2 = pd.DataFrame(np.random.rand(4,4), columns=list('EFGH'), index= [5,2,4,1])
      df1['E'] = ['hello','hello','hello','world']
      df2['E'] = ['world','world','hello','hello']
  </code></pre>
  
  <p>I want to perform an inner merge on the index and column E, so that it will return only one row:(index,E) = (1,'hello').</p>