title: Pivoting a DataFrame in Pandas for output to CSV
body: <p>This is a simple question for which answer are surprisingly difficult to find online. Here's the situation:</p>
  
  <pre><code>&gt;&gt;&gt; A
  [('hey', 'you', 4), ('hey', 'not you', 5), ('not hey', 'you', 2), ('not hey', 'not you', 6)]
  &gt;&gt;&gt; A_p = pandas.DataFrame(A)
  &gt;&gt;&gt; A_p
           0        1  2
  0      hey      you  4
  1      hey  not you  5
  2  not hey      you  2
  3  not hey  not you  6
  &gt;&gt;&gt; B_p = A_p.pivot(0,1,2)
  &gt;&gt;&gt; B_p
  1        not you  you
  0                    
  hey            5    4
  not hey        6    2
  </code></pre>
  
  <p>This isn't quite what's suggested in the documentation for <code>pivot</code> -- there, it shows results without the 1 and 0 in the upper-left-hand corner. And that's what I'm looking for, a DataFrame object that prints as</p>
  
  <pre><code>         not you  you
  hey            5    4
  not hey        6    2
  </code></pre>
  
  <p>The problem is that the normal behavior results in a csv file whose first line is</p>
  
  <pre><code>0,not you,you
  </code></pre>
  
  <p>when I really want</p>
  
  <pre><code>not you, you
  </code></pre>
  
  <p>When the normal csv file (with the preceding "0,") reads into R, it doesn't properly set the column and row names from the frame object, resulting in painful manual manipulation to get it in the right format. Is there a way to get pivot to give me a DataFrame object without that additional information in the upper-left corner?</p>