title: Convert array of indices to one-hot encoded array in NumPy
body: <p>Given a 1D array of indices:</p>
  <pre><code>a = array([1, 0, 3])
  </code></pre>
  <p>I want to one-hot encode this as a 2D array:</p>
  <pre><code>b = array([[0,1,0,0], [1,0,0,0], [0,0,0,1]])
  </code></pre>