[SciPy-User] naming columns in array
Fri Sep 10 18:28:44 CDT 2010
On Fri, Sep 10, 2010 at 7:21 PM, Dan Lussier <firstname.lastname@example.org> 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)])
dtype=[('a', '<i4'), ('b', '<i4')])
> SciPy-User mailing list
More information about the SciPy-User