[SciPy-user] Record Array: How to add a column?

Huang-Wen Chen hwchen.mailman@gmail....
Tue Oct 14 10:02:09 CDT 2008


On Tue, Oct 14, 2008 at 6:35 AM, John Hunter <jdh2358@gmail.com> wrote:

> I took Robert's suggestion from the link above and added
> rec_append_fields to matplotlib.mlab  -- I think it may have been
> called rec_append_field in 0.98.3, but we altered it in svn HEAD to
> support multiple column adds.  There are a number of nice helper
> functions for recarrays there
>
> Here is an example showing many of these functions in action


The example is amazing. It's so simple to do the elegant job, but I think it
requires some modification because the the size of the two dataset is
different:

In [68]: r1.shape
Out[68]: (6080,)

In [69]: r2.shape
Out[69]: (1046,)

Maybe we need to do some trimming in the example such as:

l = min(r1.shape[0], r2.shape[0])
r1,r2=r1[:l],r2[:l]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20081014/9aab3996/attachment.html 


More information about the SciPy-user mailing list