[SciPy-User] naming columns in array
josef.pktd at gmail.com
josef.pktd at gmail.com
Fri Sep 10 19:28:44 EDT 2010
On Fri, Sep 10, 2010 at 7:21 PM, Dan Lussier <dtlussier at gmail.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')])
Josef
>
> Thanks!
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list