Re: [Numpy-discussion] very simple iteration question.

2008-05-03 Thread Bryan Cole
On Wed, 2008-04-30 at 21:09 +0200, Gael Varoquaux wrote: > On Wed, Apr 30, 2008 at 11:57:44AM -0700, Christopher Barker wrote: > > I think I still like the idea of an iterator (or maybe making rollaxis a > > method?), but this works pretty well. > > Generally, in object oriented programming, you

Re: [Numpy-discussion] very simple iteration question.

2008-05-01 Thread Alexander Michael
On Wed, Apr 30, 2008 at 3:09 PM, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > On Wed, Apr 30, 2008 at 11:57:44AM -0700, Christopher Barker wrote: > > I think I still like the idea of an iterator (or maybe making rollaxis a > > method?), but this works pretty well. > > Generally, in object oriente

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Gael Varoquaux
On Wed, Apr 30, 2008 at 11:57:44AM -0700, Christopher Barker wrote: > I think I still like the idea of an iterator (or maybe making rollaxis a > method?), but this works pretty well. Generally, in object oriented programming, you expect a method like rollaxis to modify an object inplace. At least

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Christopher Barker
Anne Archibald wrote: >> it's much easier to just write > > for subarray in np.rollaxis(A,i): > ... cool, thanks! So the answer to the OPs question: > OK: how do i iterate over an axis other than 0? > > I have a 3D array of data[year, week, location]. I want to iterate > over each year at

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Anne Archibald
2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > a g wrote: > > OK: how do i iterate over an axis other than 0? > > This ties in nicely with some of the discussion about interating over > matrices. It ahs been suggested that it would be nice to have iterators > for matrices, so you could do:

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Christopher Barker
a g wrote: > OK: how do i iterate over an axis other than 0? This ties in nicely with some of the discussion about interating over matrices. It ahs been suggested that it would be nice to have iterators for matrices, so you could do: for row in M.rows: ... and for column in M.cols: ...

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Damian Eads
Hi Alex, a g wrote: > Hi. This is a very basic question, sorry if it's irritating. If i > didn't find the answer written already somewhere on the site, please > point me to it. That'd be great. You should look at any of the documents below and read up on array slicing. It is perhaps the most

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Anne Archibald
2008/4/30 a g <[EMAIL PROTECTED]>: > Hi. This is a very basic question, sorry if it's irritating. If i > didn't find the answer written already somewhere on the site, please > point me to it. That'd be great. > > OK: how do i iterate over an axis other than 0? > > I have a 3D array of data[y

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Nadav Horesh
for i in range(52): week_data = data[:,i,:] OR for week_data in data.transpose(1,0,2): ... Nadav -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם a g נשלח: ד 30-אפריל-08 11:11 אל: numpy-discussion@scipy.org נושא: [Numpy-discussion] very simple iteration question. Hi. This is a

[Numpy-discussion] very simple iteration question.

2008-04-30 Thread a g
Hi. This is a very basic question, sorry if it's irritating. If i didn't find the answer written already somewhere on the site, please point me to it. That'd be great. OK: how do i iterate over an axis other than 0? I have a 3D array of data[year, week, location]. I want to iterate over each