Provide DataArray.labels as an attribute computed on-demand
Closed this issue · 1 comments
llvilanova commented
This attribute is not used on any critical path and, thus, can be moved to a property computing the contents on-demand.
This will eliminate inconsistencies when printing the representation or stringification of a DataArray after changing the label of any of its Axis.
Current output is:
In [1]: import datarray.datarray as da In [2]: a = da.DataArray([1,2,3]) In [3]: a Out[3]: DataArray([1, 2, 3]) (None,) In [4]: a.ax a.axes a.axis In [4]: a.axes[0].label = "test" In [5]: a Out[5]: DataArray([1, 2, 3]) (None,) In [6]: a.axes[0] Out[6]: Axis(label='test', index=0, ticks=None)
terhorst commented
This was fixed at some point in the past year and a half. Added a test to verify. Note that axes have 'names' not 'labels' now.