[Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes

Christopher Barker Chris.Barker@noaa....
Fri Jul 9 19:00:32 CDT 2010


Keith Goodman wrote:
> On Fri, Jul 9, 2010 at 4:05 PM, Christopher Barker
> <Chris.Barker@noaa.gov> wrote:
> 
>> So what would you get if you wanted:
>>
>> MyDataArray['jones':'wilson']
>>
>> or
>>
>> MyDataArray.names[slice('jones','wilson')]
>>
>> or whatever the syntax would be?
>>
>> If it was in alphabetical order, you'd be all set, but what it if
>> wasn't? It would be pretty cool if you could get an alphabetical slice.
> 
> If it sorted the data automatically then you couldn't turn off the
> sorting.

sure -- but what would it mean to ask for a slice by name without 
sorting? If you want it in the order it happens to be in, you'd use 
numerical slicing (at least that's the use case I can imagine).

> Without automatic sorting the user gets to decide whether or
> not to sort before indexing. A sort ticks along axis function would be
> useful, sort of like
> http://larry.sourceforge.net/reference.html#la.larry.sortaxis.

Yup -- that's nice, and would take care of most issues.

-Chris





-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list