2009/4/9 Pierre GM <pgmdevlist@gmail.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 [30]: arr = np.array(((2,3),), dtype=[('x',[('a',int),('b',int)])])
In [31]: 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.
Cheers
Stéfan