[Numpy-discussion] DataArray ticks

Keith Goodman kwgoodman at gmail.com
Thu Jul 8 16:55:27 EDT 2010


What do you think of adding a ticks parameter to DataArray? Would that
make sense?

Current behavior:

>> x = DataArray([[1, 2], [3, 4]], (('row', ['A','B']), ('col', ['C', 'D'])))
>> x.axes
(Axis(label='row', index=0, ticks=['A', 'B']),
 Axis(label='col', index=1, ticks=['C', 'D']))

Proposed ticks as separate input parameter:

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

I think this would make it easier for new users to construct a
DataArray with ticks just from looking at the function signature. It
would match the function signature of Axis. My use case is to use
ticks only and not names axes (at first), so:

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

instead of the current:

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

It might also cause less typos (parentheses matching) at the command line.

I've only made a few DataArrays so I don't understanding the
ramifications of what I am suggesting.



More information about the NumPy-Discussion mailing list