[Numpy-discussion] dtype field renaming
Stéfan van der Walt
Wed Apr 8 17:47:18 CDT 2009
2009/4/9 Pierre GM <email@example.com>:
>> a.dtype.names = ('c', 'd')
> Now that's wicked neat trick ! I love it ! Faster than taking a view
> for sure.
> Note that rename_fields should work also w/ nested fields (not that
> common, true).
Yes, that is slightly more effort:
In : arr = np.array(((2,3),), dtype=[('x',[('a',int),('b',int)])])
In : arr['x'].dtype.names = ('p','q')
No all-in-one solution for renaming all the fields, but if you wanted
to do that a view would probably be the cleanest.
More information about the Numpy-discussion