[Numpy-discussion] PEP: named axis (was: Selection of only a certain number of fields)

Olivier Grisel olivier.grisel@ensta....
Fri Feb 6 01:33:11 CST 2009


On Feb 6, 2009 12:16 AM, "Gael Varoquaux" <gael.varoquaux@normalesup.org>

On Thu, Feb 05, 2009 at 05:08:49PM -0600, Travis E. Oliphant wrote:
> 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.

Hey Travis,

I have no opinion on the above, as I don't have this use case. However, as
you are talking about implementing something, I jump on the occasion to
suggest another gadget, slightly related: I would like named axis.
Suppose you have a 5D array, I would like to be able to give each axis
names, eg (to chose an example you might be familiar with) ('Frontal',
'Lateral', 'Axial', 'Time', 'Subjects'). And if this could be understood
be numpy operations (say ufuncs and fancy indexing) so that I could do (a
is my 5D array):

>>> b = a.mean(axis='Time')
>>> b.axis
('Frontal', 'Lateral', 'Axial', 'Subjects')

I believe this would make a big difference for people working with
n-dimensional arrays, where n is large.

I do realize this is probably a lot of work, this is why I had been
refraining from mentioning it. I don't feel I can implement this.


Numpy-discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090206/32d3aa22/attachment.html 

More information about the Numpy-discussion mailing list