title: How to convert a series of index/category, into a classification array
body: <p>How, to convert a series of indexes, into a 2-D array which expresses the category/classifier that's defined by the indexes values in list ?</p>
  
  <p>e.g.:</p>
  
  <pre><code>import numpy as np
  
  aList = [0,1,0,2]
  anArray = np.array(aList)
  
  resultArray = convertToCategories(anArray)
  </code></pre>
  
  <p>and the return value of <code>convertToCategories()</code> would be like:</p>
  
  <pre><code>[[1,0,0],             # the 0th element of aList is index category 0
  [0,1,0],              # the 1st element of aList is index category 1
  [1,0,0],              # the 2nd element of aList is index category 0
  [0,0,1]]              # the 3rd element of aList is index category 2
  </code></pre>
  
  <p>In last resort, I could of course:</p>
  
  <ul>
  <li>parse the list,</li>
  <li>count the number of categories (it's contiguous/continuous, it could be simply to find the maximum)</li>
  <li>create a zeroed array with the good size found</li>
  <li>then reparse the list, so as to fill the array according the indices given by the list, with 1 (or True).</li>
  </ul>
  
  <p>But I am wondering if there exists a more pythonic, or dedicated numpy, or pandas function to achieve this kind of transformation.</p>