title: Numpy reshape 1d to 2d array with 1 column
body: <p>In <code>numpy</code> the dimensions of the resulting array vary at run time.
  There is often confusion between a 1d array and a 2d array with 1 column.
  In one case I can iterate over the columns, in the other case I cannot.</p>
  
  <p>How do you solve elegantly that problem?
  To avoid littering my code with <code>if</code> statements checking for the dimensionality, I use this function:</p>
  
  <pre><code>def reshape_to_vect(ar):
      if len(ar.shape) == 1:
        return ar.reshape(ar.shape[0],1)
      return ar
  </code></pre>
  
  <p>However, this feels inelegant and costly. Is there a better solution?</p>