[Numpy-discussion] appending extra items to arrays

Travis E. Oliphant oliphant@enthought....
Wed Oct 10 23:50:37 CDT 2007

Adam Mercer wrote:
> Hi
> In some code I have, I need to append some extra data to a given
> array.  At the moment I construct the data in a list, append the extra
> information I need and then convert the final list to an array.  Is
> there a way that I can append extra information to an existing array
> thereby negating the need for the list, as the array object doesn't
> seem to have an append() method?
You can resize arrays (using the resize method), or you can use 
concatenate.  But, depending on the situation, using a list to grow the 
object and then converting at the end may be a better solution than 
resizing a large chunk of memory over and over again.


More information about the Numpy-discussion mailing list