comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: edit a large dataset
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: edit a large dataset [message #56096 is a reply to message #56095] Wed, 03 October 2007 09:45 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Oct 3, 11:40 am, hradilv <hrad...@yahoo.com> wrote:
> On Oct 3, 9:48 am, queiny <quein...@yahoo.com> wrote:
>
>
>
>> Hi, I have a large dataset (>1e7 records). One field of the record is
>> a string 'landuse'. Now I want to add one more field based on the
>> 'landuse', i.e., if it is 'forest', then add 'aa', if it is 'urban',
>> then add 'bb', etc.. Since there are more than 20 different landuse,
>> use 'if-then', or 'case' for each record will be quite inefficient.
>
>> I am thinking of 'sort' the records based on 'landuse', and then use
>> 'uniq' to locate the starting point and number of records for each
>> 'landuse' type and add the new fields accordingly. But how could I go
>> back to the original order afterward?
>
>> a=sort(data_orig)
>> data_sorted=data_orig(a)
>> ;processing based on 'data_sorted'
>
>> but how could I go back the order of 'data_orig'? Is there a inversion
>> of 'sort'.
>
>> Thanks,
>
> a=sort(data_orig)
> data_sorted=data_orig[a]
> data_orig=data_sorted[sort(a)]
>
> Cheers,
> Vince

I was considering:
data_orig = data_orig[ sort( data_orig[ sort(data_orig) ] ) ]

But thought it was little to obfuscatory 8)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: label x axis
Next Topic: dynamic widget

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 12:59:46 PDT 2025

Total time taken to generate the page: 0.48015 seconds