← Back to team overview

larry-discuss team mailing list archive

Re: Label indexing

 

On Mon, Feb 8, 2010 at 7:31 AM,  <josef.pktd@xxxxxxxxx> wrote:
> On Mon, Feb 8, 2010 at 10:18 AM, Keith Goodman <kwgoodman@xxxxxxxxx> wrote:
>> On Mon, Feb 8, 2010 at 7:15 AM,  <josef.pktd@xxxxxxxxx> wrote:
>>> On Mon, Feb 8, 2010 at 10:05 AM, Keith Goodman <kwgoodman@xxxxxxxxx> wrote:
>>>> After a long thread on how to support label indexing in larry, here's
>>>> where we ended up:
>>>>
>>>> 1. Remove the indexing of labels by strings from the trunk.
>>>>
>>>> 2. Create a method larry.lix that can be used for label indexing like this:
>>>>
>>>> lar.lix['a']
>>>> lar.lix['a':]
>>>> lar.lix[:, 'a']
>>>> lar.lix['a', 'b', 'c':]
>>>
>>> I'm not sure what the last index means, if there are several labels
>>> for the same axis, they would need to be in a list_like
>>> lar.lix[['a', 'b', 'c'], :]   to distinguish different elements for
>>> one axis from elements for several axis.
>>
>> Yep. Good catch. Typo.
>
> just for clarification, you also want to support label slices?
>
> lar.lix[['a', 'b', 'c'], '2009-01-01':]  or
> lar.lix[['a', 'b', 'c'], date1 :date2]
>
> I don't think there is any ambiguity in the interpretation

Yes, slices will be supported. So both of your examples will work if
the corresponding labels exists. Looking at your date slice made be
realize that larry needs a sortlabel method

def sortlabel(axis=None):
    etc.

where axis=None will sort all axes.

>
>>>
>>> Josef
>>>
>>>>
>>>> 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].
>>>>
>>>> 3. Indexing with more than one list will do rectangular indexing, not
>>>> fancy indexing.
>>>>
>>>> OK, that's it. I'll start. I'll need help with #3
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~larry-discuss
>>>> Post to     : larry-discuss@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~larry-discuss
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>
>>
>



Follow ups

References