[Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes

Rob Speer rspeer@MIT....
Thu Jul 8 12:41:34 CDT 2010


>> But I don't understand your second example:
>>>   arr.country['Spain'].year[1994:2010]
>
>> 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
>> names.
>
> Sorry, I just c&p without placing the necessary '.
>
>> If named were a getitem-able object, that would be:
>>>>> arr.country.named['Spain'].year.named[1994:2010]
>
> Or what I was striving for:
>
>   arr.year.named[1994:2010]
>   arr.year['1994':'2010']
>   arr.year['1994':-3]

So your proposal is, whenever there's an index that is not an integer,
look it up by name, and use .named only if you want integer tick
names? This feels too inconsistent to me. It adds a fair amount of
confusion to save a small amount of typing. If keystrokes are that
important, I'd rather replace "named" with something shorter than lose
the distinction entirely.
-- Rob


More information about the NumPy-Discussion mailing list