Francesc Alted wrote:
> A Tuesday 18 November 2008, Eric Bruning escrigué:
>> If extended slicing isn't supported, is there a better way to deal
>> with sparse indices than:
>> for row_id, datum in zip(row_ids, coldata):
>>      col[row_id] = datum
> 
> Yes, there is.  You can make use of the .itersequence() iterator 
> combined with the .update() method:
> 
> for i, row in enumerate(tbl.itersequence(row_ids)):
>     row['col'] = coldata[i]
>     row.update()
> tbl.flush()
> 
> This method has the advantage that the update is made by using an 
> internal buffer, so it will be faster in general (specially when you 
> modify a lot of rows) than the one you suggested.

Two questions:

1. Is there a similar function for Arrays?  I don't see one.

2. The documentation for Table.itersequence says:
--
itersequence(sequence, sort=True)

Iterate over a sequence of row coordinates.

A true value for sort means that the sequence will be sorted so that I/O 
might perform better. If your sequence is already sorted or you don't 
want to sort it, leave this parameter as false. The default is not to 
sort the sequence.
--
Is the default sort=True or sort=False.  The signature and the last 
sentence disagree.


-- 
Anthony Foglia
Princeton Consultants
(609) 987-8787 x233


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to