[Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes
Thu Jul 8 10:55:00 CDT 2010
Joshua Holbrook writes:
> On Thu, Jul 8, 2010 at 3:13 AM, Lluís <firstname.lastname@example.org> wrote:
>> Rob Speer writes:
>>>>>> arr.country.named('Spain').year.named(slice(1994, 2010))
>> This looks too verbose to me.
>> As axis always have a total order, I'd go for the most compact representation
>> (assuming 'country' is the first axis, and 'year' the second one):
>> Thus, we can use something in the middle:
>> arr.names['Netherlands',2010] # I'd rather go for 'names' instead of 'ticks'
> Isn't this the __getitem___ action we were trying to avoid?
Sorry but I hooked into the whole naming discussion just now, so I'm not aware
of much previous discussions except for this thread.
What I assumed is that 'arr[...]' is not a desired syntax because of a possible
That's why I think 'arr.names[...]' might be a good compromise. Use 'arr' for
the standard integer-based indexing, and 'arr.names' for the fancy mixed
My opinion is that no integer name/tick must be allowed (thus the above example
would be arr.names['Netherlands','2010']), such that the user is able to mix
"real" indexes with names. Whether this mix makes any sense or not, is something
that I'm not sure about, but I'd try to eliminate "unnecessary" typing as much
"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