[Numpy-discussion] setting rows of a numpy array

wilson wilson.t.thompson@gmail....
Sun Apr 27 12:15:31 CDT 2008

hi all,
i have a numpy array of floats whose rows i need to set. i am setting
the each row using pixel values of each image in some folder.I wrote a
class MyImage that has a field pixelarray which stores the pixels of
that image as a numpy array.I made several MyImage instances and
stored them in a list called myimagefileslist. i can get the pixels
of each image as a numpy  array using myimagefileslist[i]._pixelarray
where _pixelarray is a field of MyImage class .

now i defined a function that sets a row of a given array as below

def putrow(myarray,inrow ,rownum):

in my code i initially make an empty array
then i set the rows using

for i in range(numofimgs):

this gets me the myimagesdata array updated with the  pixeldata of
images from myimagefileslist.But i am wondering if there is a better
way to do this.If anyone can suggest improvements it wd be helpful

More information about the Numpy-discussion mailing list