larry-discuss team mailing list archive
-
larry-discuss team
-
Mailing list archive
-
Message #00113
Index by label support added to experimental branch
I made a branch called index-by-label:
https://code.launchpad.net/~kwgoodman/larry/index-by-label
and added support for indexing by label. It is all self contained in
one method: deflarry.py(lix). So easy to try.
Here are a few one-off tests:
>> y = la.larry([[1,2],[3,4]], [['a', 'b'], ['c', 'd']])
>> y.lix[['a']]
label_0
c
d
x
array([1, 2])
>> y.lix[['b', 'a']]
label_0
b
a
label_1
c
d
x
array([[3, 4],
[1, 2]])
>> y.lix[['a']:]
label_0
a
b
label_1
c
d
x
array([[1, 2],
[3, 4]])
>> y.lix[:['b']]
label_0
a
label_1
c
d
x
array([[1, 2]])
>> y.lix[['a'], ['c']:]
label_0
c
d
x
array([1, 2])
>> y.lix[['a'], ['d', 'c']]
label_0
d
c
x
array([2, 1])
>> y.lix['a':] # <--- expected to crash
ValueError: The start element of a slice must be a list.
Follow ups