How to append element to each vector in a matrix - Python
<p>I have a 500x2 matrix which has been filled using <code>numpy.random.rand</code>.</p>

<p>The output looks like this (but obviously a larger version):</p>

<pre><code> [ -3.28460744e+00  -4.29156493e-02]
 [ -1.90772015e-01  -9.17618367e-01]
 [ -2.41166994e+00  -3.76661496e+00]
 [ -2.43169366e+00  -6.31493375e-01]
 [ -1.48902305e+00  -9.78215901e-01]
 [ -3.11016192e+00  -1.87178962e+00]
 [ -3.72070031e+00  -1.66956850e+00]
</code></pre>

<p>I want to append <code>1</code> to the end of each row so that each line would look like this:</p>

<pre><code>[ -3.72070031e+00  -1.66956850e+00  1]
</code></pre>

<p>Is this possible? I've been trying to use <code>numpy.append()</code> but struggling to work out what should be used.</p>

<p>Any help would be much appreciated!</p>