title: numpy convert categorical string arrays to an integer array
body: <p>I'm trying to convert a string array of categorical variables to an integer array of categorical variables.</p>
  
  <p>Ex.</p>
  
  <pre><code>import numpy as np
  a = np.array( ['a', 'b', 'c', 'a', 'b', 'c'])
  print a.dtype
  &gt;&gt;&gt; |S1
  
  b = np.unique(a)
  print b
  &gt;&gt;&gt;  ['a' 'b' 'c']
  
  c = a.desired_function(b)
  print c, c.dtype
  &gt;&gt;&gt; [1,2,3,1,2,3] int32
  </code></pre>
  
  <p>I realize this can be done with a loop but I imagine there is an easier way. Thanks.</p>