I would like to know how I can add row to a matrix in python numpy. For instance, in Matlab we can do A=[1;zeros(10,1)]
, how can I do that in numpy?
Thanks.
I would like to know how I can add row to a matrix in python numpy. For instance, in Matlab we can do A=[1;zeros(10,1)]
, how can I do that in numpy?
Thanks.
Try this:
import numpy
...
# L is your 2-dimensional list
M = numpy.matrix(L)
# R is the list (i.e. a row) to add
M = numpy.vstack([M, R])