[Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes
Thu Jul 8 12:03:47 CDT 2010
Rob Speer writes:
> On Thu, Jul 8, 2010 at 7:13 AM, Lluís <email@example.com> wrote:
>> Thus, we can use something in the middle:
>> arr.names['Netherlands',2010] # I'd rather go for 'names' instead of 'ticks'
> Ah ha. So this is the case with positional axes but named ticks, which
> we haven't really brought up yet. I'm definitely thinking of making
> the top-level datarray support "named" as well, which would make it
>>>> arr.named('Netherlands', 2010)
> But the other change you've got here is to make "named" into a
> __getitem__-able object instead of a method, so you use square
> brackets with it and can use slice syntax. I could do it this way as
Right, seamless slicing is precisely why I have __getitem__.
> But I don't understand your second example:
> That seems to run straight into the index/name ambiguity. Shouldn't
> that take the 1994th through 2010th indices along the "year" axis? Not
> every axis will have names, so you can't make *all* the indexing go by
Sorry, I just c&p without placing the necessary '.
> If named were a getitem-able object, that would be:
Or what I was striving for:
I already have the code for managing all kinds of indexind methods in sciexp2,
so I you want I could try to integrate it into datarray.
"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