[Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes
Lluís
xscript@gmx....
Thu Jul 8 12:56:32 CDT 2010
Rob Speer writes:
>> 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.
No. I'd rather go for eliminating the 'arr.year.named', and providing only:
* arr.__getitem__
* arr.named.__getitem__
* arr.<label>.__getitem__
The first being just the current ndarray.__getitem__, and the two last methods
would accept both strings and integers, assuming that names/ticks based on
integers (e.g., the 1994 above) must be provided as strings, or otherwise are
treated as good old array indexes.
Lluis
--
"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
Tollbooth
More information about the NumPy-Discussion
mailing list