[Numpy-discussion] dtype field renaming
Stéfan van der Walt
stefan at sun.ac.za
Wed Apr 8 18:18:03 EDT 2009
2009/4/9 Pierre GM <pgmdevlist at gmail.com>:
>> for a numpy.recarray, is it possible to rename the fields in the
>> dtype?
>
> Take a new view:
> >>> a = np.array([(1,1)],dtype=[('a',int),('b',int)])
> >>> b = a.view([("A",int), ('b', int)])
>
> or:
>
> use numpy.lib.recfunctions.rename_fields
Or change the names tuple:
a.dtype.names = ('c', 'd')
Stéfan
More information about the NumPy-Discussion
mailing list