title: Pandas Merge (pd.merge) How to set the index and join
body: <p>I have two pandas dataframes:  dfLeft and dfRight with the date as the index.</p>
  
  <p>dfLeft:</p>
  
  <pre><code>            cusip    factorL
  date  
  2012-01-03    XXXX      4.5
  2012-01-03    YYYY      6.2
  ....
  2012-01-04    XXXX      4.7
  2012-01-04    YYYY      6.1
  ....
  </code></pre>
  
  <p>dfRight:</p>
  
  <pre><code>            idc__id    factorR
  date  
  2012-01-03    XXXX      5.0
  2012-01-03    YYYY      6.0
  ....
  2012-01-04    XXXX      5.1
  2012-01-04    YYYY      6.2
  </code></pre>
  
  <p>Both have a shape close to <code>(121900,3)</code></p>
  
  <p>I tried the following merge:</p>
  
  <pre><code>test = pd.merge(dfLeft, dfRight, left_index=True, right_index=True, left_on='cusip', right_on='idc__id', how = 'inner')
  </code></pre>
  
  <p>This gave test a shape of <code>(60643500, 6)</code>.</p>
  
  <p>Any recommendations on what is going wrong here?  I want it to merge based on both date and cusip/idc_id.  Note:  for this example the cusips are lined up, but in reality that may not be so.</p>
  
  <p>Thanks.</p>
  
  <p>Expected Output
  test:</p>
  
  <pre><code>             cusip    factorL    factorR
  date  
  2012-01-03    XXXX      4.5          5.0
  2012-01-03    YYYY      6.2          6.0
  ....
  2012-01-04    XXXX      4.7          5.1
  2012-01-04    YYYY      6.1          6.2
  </code></pre>