title: How to add ones to matrix?
body: <p>I have an array:</p>
  
  <pre><code>X = [[2, 2, 2],
       [3, 3, 3],
       [4, 4, 4]]
  </code></pre>
  
  <p>I need to add extra column in numpy array and fill it with ones using hstack and reshape. Like that:</p>
  
  <pre><code>X = [[2, 2, 2, 1],
       [3, 3, 3, 1],
       [4, 4, 4, 1]]
  </code></pre>
  
  <p>What I do:</p>
  
  <pre><code>X = np.hstack(X, np.ones(X.reshape(X, (2,3))))
  </code></pre>
  
  <p>And a get an error:</p>
  
  <pre><code>TypeError: only length-1 arrays can be converted to Python scalars
  </code></pre>
  
  <p>What's a problem? What I've done wrong?</p>