[Numpy-discussion] Renaming a field of an object array
Pierre GM
pgmdevlist at gmail.com
Wed Feb 4 17:50:38 EST 2009
All,
I'm a tad puzzled by the following behavior (I'm trying to correct a
bug in genfromtxt):
I'm creating an empty structured ndarray, using np.object as dtype.
>>> a = np.empty(1,dtype=[('',np.object)])
array([(None,)],
dtype=[('f0', '|O4')])
Now, I'd like to rename the field:
>>> a.view([('NAME',np.object)])
TypeError: Cannot change data-type for object array.
I understand why I can't change the *type* of the field, but not why I
can't change its name that way. What would be an option that wouldn't
involve creating a new array ?
Thx in advance.
More information about the NumPy-Discussion
mailing list