Re: [Numpy-discussion] how to avoid re-shaping

2012-05-22 Thread Massimo DiPierro
On May 22, 2012, at 10:12 AM, Robert Kern wrote: > On Tue, May 22, 2012 at 4:09 PM, Massimo DiPierro > wrote: >> One more questions (since this list is very useful. ;-) >> >> If I have a numpy array of arbitrary shape, is there are a way to >> sequentially loop over its elements without reshap

Re: [Numpy-discussion] how to avoid re-shaping

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 4:09 PM, Massimo DiPierro wrote: > One more questions (since this list is very useful. ;-) > > If I have a numpy array of arbitrary shape, is there are a way to > sequentially loop over its elements without reshaping it into a 1D array? > > I am trying to simplify this: >

[Numpy-discussion] how to avoid re-shaping

2012-05-22 Thread Massimo DiPierro
One more questions (since this list is very useful. ;-) If I have a numpy array of arbitrary shape, is there are a way to sequentially loop over its elements without reshaping it into a 1D array? I am trying to simplify this: n=product(data.shape) oldshape = data.shape newshape = (n,) data.resh