I have a 500x2 matrix which has been filled using numpy.random.rand
.
The output looks like this (but obviously a larger version):
[ -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]
I want to append 1
to the end of each row so that each line would look like this:
[ -3.72070031e+00 -1.66956850e+00 1]
Is this possible? I've been trying to use numpy.append()
but struggling to work out what should be used.
Any help would be much appreciated!