What is the cleanest way to add a field to a structured numpy array? Can it be done destructively, or is it necessary to create a new array and copy over the existing fields? Are the contents of each field stored contiguously in memory so that such copying can be done efficiently?
Take the 2-minute tour
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
If you're using numpy 1.3, there's also numpy.lib.recfunctions.append_fields(). For many installations, you'll need to |
||||
|
|
|||
|