[SciPy-User] Populating a recarray from 0 size
Sun Aug 22 10:19:04 CDT 2010
> On Sat, Aug 21, 2010 at 9:18 PM, Sergi Pons Freixes <firstname.lastname@example.org>
> > Hi everybody,
> > I'm interested in populating a recarray a row at a time. I thought in
> I don't know the answer, but it would be more efficient to correctly
> size the empty array, if you know the size, or to build up the array
> first as a list of tuples before converting to an array.
My approach in this kind of situation has been using pytables, creating an
empty table with a specific dtype, and then populating the table with the
append method. It seems very efficient, and quite convenient in situations
where I eventually will need to persist data to disk somehow.
Reading the table into an in memory recarray is then easily done using
data = h5file.root.datatable[:].view(numpy.recarray)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User