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

Rob Speer rspeer at MIT.EDU
Thu Jul 8 15:19:29 EDT 2010


> 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.

There are lots of data types besides strings that make good names
(tuples, for example).

My impression from SciPy was that people would prefer separate
accessors for names and indices, especially because integers (a really
common data type, after all) shouldn't be forbidden. Also, working
with strings of integers like '2010' makes me feel like I'm using PHP,
a feeling I like to avoid whenever possible. :)

-- Rob



More information about the NumPy-Discussion mailing list