title: Pandas: Convert DataFrame Column Values Into New Dataframe Indices and Columns
body: <p>I have a dataframe that looks like this:</p>
  
  <pre><code>a  b  c
  0  1  10
  1  2  10
  2  2  20
  3  3  30
  4  1  40
  4  3  10
  </code></pre>
  
  <p>The dataframe above as default (0,1,2,3,4...) indices. I would like to convert it into a dataframe that looks like this:</p>
  
  <pre><code>    1     2     3
  0   10    0     0
  1   0     10    0
  2   0     20    0
  3   0     0     30
  4   40    0     10
  </code></pre>
  
  <p>Where column 'a' in the first dataframe becomes the index in the second  dataframe, the values of 'b' become the column names and the values of c are copied over, with 0 or NaN filling missing values. The original dataset is large and will result in a very sparse second dataframe. I then intend to add this dataframe to a much larger one, which is straightforward.</p>
  
  <p>Can anyone advise the best way to achieve this please?</p>