Re: [Numpy-discussion] Advice please on efficient subtotal function

2007-01-03 Thread Andreas Eisele
Hi Stephen, > > I'm looking for efficient ways to subtotal a 1-d array onto a 2-D > grid. This > is more easily explained in code that words, thus: > > for n in xrange(len(data)): > totals[ i[n], j[n] ] += data[n] > > data comes from a series of PyTables files with ~200m rows. Each row > has ~2

Re: [Numpy-discussion] Advice please on efficient subtotal function

2006-12-29 Thread Stephen Simmons
Thanks Francesc, but I am already planning to read the data in block-wise as you suggest. My question is rather how best to update the subtotals for each block in a parallel way using numpy efficiently, rather than a simplistic and slow element-by-element loop. I can't use a simple sum(), as in y

Re: [Numpy-discussion] Advice please on efficient subtotal function

2006-12-29 Thread Francesc Altet
A Divendres 29 Desembre 2006 10:05, Stephen Simmons escrigué: > Hi, > > I'm looking for efficient ways to subtotal a 1-d array onto a 2-D grid. > This is more easily explained in code that words, thus: > > for n in xrange(len(data)): > totals[ i[n], j[n] ] += data[n] > > data comes from a serie

Re: [Numpy-discussion] Advice please on efficient subtotal function

2006-12-29 Thread Greg Willden
Hi Stephen, If you want to sum/average down a column or across a row you can use sum(). The optional axis={0,1} parameter determines whether you are summing down a column (default or axis=0) or across a row (axis=1). Greg On 12/29/06, Stephen Simmons <[EMAIL PROTECTED]> wrote: Hi, I'm looking

[Numpy-discussion] Advice please on efficient subtotal function

2006-12-29 Thread Stephen Simmons
Hi, I'm looking for efficient ways to subtotal a 1-d array onto a 2-D grid. This is more easily explained in code that words, thus: for n in xrange(len(data)): totals[ i[n], j[n] ] += data[n] data comes from a series of PyTables files with ~200m rows. Each row has ~20 cols, and I use the fir