title: How to transpose pandas data frame by a column and value?
body: <p>I have a dataframe like this</p>
  
  <p><strong>Input</strong></p>
  
  <pre><code>student_id  rep
  abc100      1   
  abc101      2
  abc102      1
  abc103      2
  abc104      1
  abc105      2
  abc106      1
  abc107      2
  </code></pre>
  
  <p><strong>Expected output</strong></p>
  
  <pre><code>1       2
  abc100  abc101
  abc102  abc103
  abc104  abc105
  abc106  abc107
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>df = df.pivot( columns='rep', values='student_id')
  </code></pre>
  
  <p>but it contains lot of nans and didnt give expected output.</p>
  
  <p>I searched in stackoverflow but couldnt find an answer.</p>