[Numpy-discussion] BOF notes: Fernando's proposal: NumPy?ndarray with named axes
Tue Jul 13 07:31:26 CDT 2010
Ryan May writes:
> On Mon, Jul 12, 2010 at 8:04 AM, Neil Crighton <firstname.lastname@example.org> wrote:
>> Gael Varoquaux <gael.varoquaux <at> normalesup.org> writes:
>>> I do such manipulation all the time, and keeping track of which axis is
>>> what is fairly tedious and error prone. It would be much nicer to be able
>>> to write:
>> Thanks, that's a really nice description. Instead of
>> I think it would be clearer to do something like
> IIRC somewhere, at least at the BOF, this exact syntax was intended to
> be supported.
Yes, this is already implemented on datarray.
Even if the 'axis' argument were not automatically translated from an axis name
to the axis index (i.e., an extension on top of scipy, as the current
datarray implementation patches functions one-by-one), you could still be
getting the index through the name with something similar to:
Note that this arr.axis['day'] is still not implemented, but I wrote on the wiki
the possibility of providing it (as well as someone else commented on the
give me an accessor the the 'Axis' objects in 'arr'
give me the 'Axis' named 'day'
give me the index of this 'Axis' in 'arr' (the position on the list of
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
More information about the NumPy-Discussion