Add ability to index by label

Registered by kwgoodman

Create a method larry.lix that can be used for label indexing like this:

lar.lix['a'] # row 'a'
lar.lix['a':] # row 'a' and everything to the right (slicing)
lar.lix[:, 'a'] # column 'a'
lar.lix['a', 'b', 'c'] # single element from 3d larry
lar.lix[['a', 'b', 'c']] # rows 'a', 'b', and 'c'
lar.lix['a':'b'] # slice
lar.lix['a':'b':2] # slice with step

Only labels and slices are allowed. Inside the function the labels will be converted to indices and then a call will be made to lar[converted_index].

Indexing with more than one list of labels will do rectangular indexing, not fancy indexing.

One problem with the design above: Consider the first example above but instead of 'a', let's make the
label ('a', 2). Inside getitem I won't know what that means. Because:

>> class Index(object):
  ....:     def __init__(self):
  ....:         pass
  ....:     def __getitem__(self, index):
  ....:         print index
  ....:
  ....:
>> idx = Index()
>> idx[('a', 1)]
('a', 1)
>> idx['a', 1]
('a', 1)

So to allow indexing by labels that are tuples, I'll need to change the design to:

       lar.lix[['a']] # row 'a'
       lar.lix[['a']:] # row 'a' and everything to the right (slicing)
       lar.lix[:, ['a']] # column 'a'
       lar.lix[['a'], ['b'], ['c']] # single element from 3d larry
       lar.lix[['a', 'b', 'c']] # rows 'a', 'b', and 'c'
       lar.lix[['a']:['b']] # slice
       lar.lix[['a']:['b']:2] # slice with step

Not as pretty.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon 0.2
Started by
kwgoodman
Completed by
kwgoodman

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.