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

Keith Goodman kwgoodman@gmail....
Fri Jul 9 20:26:20 CDT 2010


On Fri, Jul 9, 2010 at 6:11 PM, Joshua Holbrook <josh.holbrook@gmail.com> wrote:

> I think I like being able to group ticks with their axis, so I know
> which ticks belong to which axis without having to scan back-and-forth
> between them to match them up. Do you think you can explain why you
> would prefer to separate labels and ticks?

You wouldn't have to know that (labels, ticks) has to be a tuple. If
you write it is a list [label, tick] it doesn't work. As is, you don't
have the option to let labels be any hashable object, like tuples
since tuples have a special meaning.

It would treat labels and ticks on an equal footing. And it would be
the same signature as Axis which has separate label and ticks
parameters. And you could make a tick only DataArray (i.e., no axis
labels) without writing None for each axis label. That's was my main
concern since that it what I plan to do at first.

So I could write:

>>> DataArray([[1, 2], [3, 4]], ticks=[['A', 'B'], ['C', 'D']])

instead of

>>> DataArray([[1, 2], [3, 4]], ((None, ['A','B']), (None, ['C', 'D'])))

Less likely to have problems with matching parentheses.


More information about the NumPy-Discussion mailing list