The current implementation explicitly refuses integer labels, but multiple parties have expressed that this would be a very important feature to have. We've thought that it could be implemented by leaving all normal indexing operations to treat integers like python/numpy do already, but having a .lix 'label integer' indexing attribute that interprets its integer arguments as labels instead and translates them.
The current behavior is:
In [131]: t = DataArray(array([100,200,300]), [['x', ['10','20','-5']]])
In [132]: t['-5']
Out[132]: 300
But if we allow integer labels, this would work:
In [131]: t = DataArray(array([100,200,300]), [['x', [10,20,-5]]])
In [132]: t.lix[-5]
Out[132]: 300
In [132]: t.axis.x.lix[-5]
Out[132]: 300
t[-5] -> would give an error, it would treat -5 like a normal from-the-end index
The current implementation explicitly refuses integer labels, but multiple parties have expressed that this would be a very important feature to have. We've thought that it could be implemented by leaving all normal indexing operations to treat integers like python/numpy do already, but having a
.lix
'label integer' indexing attribute that interprets its integer arguments as labels instead and translates them.The current behavior is:
But if we allow integer labels, this would work: