title: Pandas dataframe: how to group by values in a column and create new columns out of grouped values
body: <p>I have a dataframe with two columns:</p>
  
  <pre><code>x y
  0 1
  1 1
  2 2
  0 5
  1 6
  2 8
  0 1
  1 8
  2 4
  0 1
  1 7
  2 3
  </code></pre>
  
  <p>What I want is:</p>
  
  <pre><code>x val1 val2 val3 val4
  0 1 5 1 1
  1 1 6 8 7
  2 2 8 4 3
  </code></pre>
  
  <p>I know that the values in column x are repeated all N times.</p>