[SciPy-User] naming columns in array
Fri Sep 10 20:12:23 CDT 2010
On Fri, Sep 10, 2010 at 6:28 PM, <firstname.lastname@example.org> wrote:
> On Fri, Sep 10, 2010 at 7:21 PM, Dan Lussier <email@example.com> wrote:
> > I was wondering if there was possible to change the dtpye of an array
> > once it exits.
> > Here is my situation.
> > I have either a N x 1 column, or a N x M array where I would like to
> > be able to name the columns after the array exists.
> > I have tried working with record arrays a bit, but no luck. If
> > someone might be able to scratch a quick example I'd be grateful.
> creating a view with structured dtype
> >>> x = np.array([[1, 2],[3,4]])
> >>> x.view(dtype=[('a', np.int32), ('b', np.int32)])
> array([[(1, 2)],
> [(3, 4)]],
> dtype=[('a', '<i4'), ('b', '<i4')])
Maybe a labeled array (a.k.a. - larry)? larry, the manual — la v0.4.0
> > Thanks!
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> SciPy-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User