title: Pandas: Select rows and add on the right as multiple sets of columns (reshape?)
body: <pre class="lang-py prettyprint-override"><code>df = pd.DataFrame({
      'pid': [10,20,10,30], 
      'sid': [1,1,2,3],
      'data1': ['a','b','a','c'],
      'data2': ['q','w','e','e'],
  })
  
     pid  sid data1 data2
  0   10    1     a     q
  1   20    1     b     w
  2   10    2     a     e
  3   30    3     c     e
  </code></pre>
  
  <p>Can be many rows <code>data</code>. Perhaps, can use <code>index = ['pid', 'sid']</code>.</p>
  
  <p>How I can transform it to Excel in the following format? </p>
  
  <p>That is, index by <code>pid</code>, select row blocks by the  'sid', with iteration by incrementation of it. Then add these as blocks of columns to the right.</p>
  
  <pre class="lang-py prettyprint-override"><code>sid   1             2              3
  pid   data1  data2  data1  data2   data1  data2
   10   a      q      a      e       None   None
   20   b      w      None   None    None   None
   30   None   None   None   None    c      e
  </code></pre>
  
  <p>Thank you.</p>