title: Merging Two Pandas Cross Tabs: Index and Col Name Issues
body: <p>This is a two-part question:</p>
  
  <p>1) I have two cross-tabs, which I would like in one df. I need to change the column names. I thought this would be easy. The docs made it look easy. The top of the frame looks like this:</p>
  
  <pre><code>Category    0.0 1.0
  Name        
  Bob         1   0
  </code></pre>
  
  <p>I'd like it to look like this:</p>
  
  <pre><code>Category    Loss Win
  Name        
  Bob         1    0
  </code></pre>
  
  <p>When I tried colnames = and got an error, I asked what it thought the column names were and got . . . </p>
  
  <pre><code>Float64Index([0.0, 1.0], dtype='float64', name='Category')
  </code></pre>
  
  <p>I tried to correct this with . . .</p>
  
  <pre><code>colnames=['Loss', 'Win', 'Category']
  </code></pre>
  
  <p>But I got: <code>AssertionError: arrays and names must have the same length</code>, which makes little sense to me in this context, as I have changed the column names of df's before with no issues.</p>
  
  <p>2) I dream of joining the above to another cross tab. I thought an inner join might work. If the names appeared in both cross tabs, I wanted them in my merged table, if not then forget 'em. However, since some of the names in the left table (lets call the table above the left table) did not appear in the right table (I'm joining on the category column, which is just a list of names), the inner join was a no go. My end goal is to get to a Chi-Square test with a cross-frequency table that looks something like . . .</p>
  
  <pre><code>           Category1    Win    Loss
  Category2
      Win2                5      20
  
      Loss2               10      5
  </code></pre>
  
  <p>Any ideas on a work around on one or both issues, and getting me to the chi-square of my dreams, would be appreciated.</p>
  
  <p>EDIT: Example of merged dataframe on which I would like to get a cross frequency/ chi-square.</p>
  
  <pre><code>DF1:
      Category    Loss Win
      Name        
      Bob         1    0
      Alice       5    1
      Anne        1    0
      Betty       8    2
      Joan        4    1
  
  DF2:
      Category2   Loss2 Win2
      Name        
      Alice       1    1
      Anne        0    1
      Betty       1    3
      Joan        1    1
  
  Combined Table:
  Category    Loss    Win  Loss2 Win2
      Name        
      Alice       5    1    1    1
      Anne        1    0    0    1
      Betty       8    2    1    3
      Joan        4    1    1    1
  </code></pre>
  
  <p>Join DF1 and DF2 only on those names that appear in both such that the final table has a Category (i.e, names) column, Loss &amp; Win columns from DF1, and Loss2 and Win2 columns from DF2. I assume this will allow me to construct cross tab I need for a chi square (see above).  </p>