Hi,

I am looping through the rows of my table. I gave only the start
argument, like this:

(Pdb) print h5target.root.collocations.nrows
10821605
(Pdb) rr = h5target.root.collocations.iterrows(start=152619)
(Pdb) rr.next()
/collocations.row (Row), pointing to row #152619
(Pdb) rr.next()
*** StopIteration:

Apparently, I should also give the stop argument:

(Pdb) rr = h5target.root.collocations.iterrows(start=152619, stop=-1)
(Pdb) rr.next()
/collocations.row (Row), pointing to row #152619
(Pdb) rr.next()
/collocations.row (Row), pointing to row #152620
(Pdb) rr.next()
/collocations.row (Row), pointing to row #152621


Is this on purpose? If so, what is the rationale? Personally, I would
expect a behaviour where giving only start is like T[start:], not
T[start]. This is what itertools.islice does, e.g. skip all elements
up to start, then include all until the end:

In [8]: from itertools import islice

In [9]: foo = rand(20)

In [10]: rr = islice(foo, 10)

In [11]: rr.next(); rr.next(); rr.next()
Out[11]: 0.66787559184068779
Out[11]: 0.70030787622211632
Out[11]: 0.97246376839426341
(etc.)

What's going on with pytables Table.iterrows()?

Gerrit.

-- 
Gerrit Holl
PhD student at Department of Space Science, LuleƄ University of
Technology, Kiruna, Sweden
http://www.sat.ltu.se/members/gerrit/

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to