[Numpy-discussion] How to change the dtype of a structured or record array

Stéfan van der Walt stefan@sun.ac...
Tue Sep 15 07:46:17 CDT 2009


Hi Bruce

2009/9/14 Bruce Southey <bsouthey@gmail.com>:
> I would like to change the dtype of just one field of a structured or
> record array without copying the original array. I can not change the
> creation of the original array because it was created using genfromtxt.

You can't do that, unfortunately.  You can view the array using any
dtype of the same length as the old one, but you can't modify the
length of single elements without re-allocation.

Regards
Stéfan


More information about the NumPy-Discussion mailing list