[Numpy-discussion] setting items in a matrix

devnew@gmai... devnew@gmai...
Fri Dec 21 01:37:44 CST 2007


hi
i am a beginner with numpy and python,so pardon me if this doubt seems
silly
i want to create a matrix with say 3 rows and 5 columns..and then set
the values of each item in it .for this i did something like below

myarray=zeros((3,5))
#then set the items
for row in range(3):
    for col in range(5):
        myarray[row][col]=999999.9999


mymatrix=matrix(myarray)

is this the way to do the matrix creation and value setting?  is the
use of  zeros() unnecessary?  i  am in the early learning stage so
your reply wd help me much

dn


More information about the Numpy-discussion mailing list