title: transpose a subset columns in dataframe (not groupby, need to create new columns)
body: <p>I've a table which has two columns, the first one is the indice of the site, and the second is the number of states per hour during 24 hours. Thus for each site, I've 24(lines)x2(columns) data. How can I transpose the second column (24 lines data per site) into the line which contains 24+1 columns with site indice. </p>
  
  <p>I've found a naive solution by using loop to create new line:</p>
  
  <pre><code>for i in range(numberOfsites):
      i1 = i*24
      i2 = i1 + 24
      newLine = DataFrame(sitesData,index=list(range(i1,i2)), columns=["siteState"]).T
  </code></pre>
  
  <p>could anyone propose another easier solution? Thank you in advance. </p>
  
  <p>Original data: (thanks to Andy Hayden for the data)</p>
  
  <pre><code>   site_index state
  0           1     a
  1           1     b
  2           1     a
  3           2     a
  4           2     a
  5           2     b
  </code></pre>
  
  <p>Desired data: </p>
  
  <pre><code>              0  1  2
    site_index
    1           a  b  a
    2           a  a  b
  </code></pre>