Loopless syntax for 2d in NumPy (or Numarray)

2mc mcrider at bigfoot.com
Sun Oct 19 15:08:17 EDT 2003


I am finding out all kinds of ways to do things in NumPy through the
many suggestions I have received.  It's exciting. Thanks to all who
have replied on my other threads.

I'm still having trouble with one thing.  Let me set a scenario and
see if anyone has any ideas.

Assume a multidimensional array (2d).  This would be like a
spreadsheet of rows and columns.  Further, assume hundreds of 'rows'
and 3 columns. Suppose I want a running list of the highest value in a
single column for 20 'rows'.  So, starting at 'row' 19, the answer
would be the highest value from 'row' 0 to 'row' 19.  Then, at 'row'
20, the answer would be the highest value from 'row' 1 to 'row' 20.
And, so on.  Further, suppose I want this value for each 'column'. 
The result would be a 3 'column' array with 19 less rows than the
source array and would contain a running list of highest values of
each column for the last 20 rows.

How would this be done without loops?  Or, at least without looping
through every row.

If it can't be done, is this something that numarray could do?

Thanks a million.

Matt




More information about the Python-list mailing list