[Numpy-discussion] Selection of only a certain number of fields
Travis E. Oliphant
Thu Feb 5 17:08:49 CST 2009
I've been fairly quiet on this list for awhile due to work and family
schedule, but I think about how things can improve regularly. One
feature that's been requested by a few people is the ability to select
multiple fields from a structured array.
Thus, suppose *arr* is a structured array with dtype:
Then, newarr = arr[['name', 'age']] should be a structured array with
just the name and age fields.
It seems to me that there are two reasonable behaviors here (and
possibly two different approaches to getting those behaviors):
1) Copy the data into a new array with a new dtype
2) Create a new array that is just a view of the old data with some of
the fields "hidden"
I lean for having the proposed syntax do #2, but wonder what other
Any opinions and/or suggestions?
More information about the Numpy-discussion