Re: [Numpy-discussion] Inplace shift

2008-06-10 Thread Keith Goodman
On Sat, Jun 7, 2008 at 6:48 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/6/7 Keith Goodman <[EMAIL PROTECTED]>: >> On Fri, Jun 6, 2008 at 10:46 PM, Anne Archibald >> <[EMAIL PROTECTED]> wrote: >>> 2008/6/6 Keith Goodman <[EMAIL PROTECTED]>: I'd like to shift the columns of a 2d array o

Re: [Numpy-discussion] Inplace shift

2008-06-07 Thread Anne Archibald
2008/6/7 Keith Goodman <[EMAIL PROTECTED]>: > On Fri, Jun 6, 2008 at 10:46 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: >> 2008/6/6 Keith Goodman <[EMAIL PROTECTED]>: >>> I'd like to shift the columns of a 2d array one column to the right. >>> Is there a way to do that without making a copy? >>>

Re: [Numpy-discussion] Inplace shift

2008-06-07 Thread Keith Goodman
On Fri, Jun 6, 2008 at 10:46 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/6/6 Keith Goodman <[EMAIL PROTECTED]>: >> I'd like to shift the columns of a 2d array one column to the right. >> Is there a way to do that without making a copy? >> >> This doesn't work: >> import numpy as np >>

Re: [Numpy-discussion] Inplace shift

2008-06-06 Thread Anne Archibald
2008/6/6 Keith Goodman <[EMAIL PROTECTED]>: > I'd like to shift the columns of a 2d array one column to the right. > Is there a way to do that without making a copy? > > This doesn't work: > >>> import numpy as np >>> x = np.random.rand(2,3) >>> x[:,1:] = x[:,:-1] >>> x > > array([[ 0.44789223, 0.

Re: [Numpy-discussion] Inplace shift

2008-06-06 Thread Robert Kern
On Fri, Jun 6, 2008 at 2:08 PM, Zachary Pincus <[EMAIL PROTECTED]> wrote: >> I'd like to shift the columns of a 2d array one column to the right. >> Is there a way to do that without making a copy? > > I think what you want is numpy.roll? It doesn't work inplace. It creates a new array, thereby ef

Re: [Numpy-discussion] Inplace shift

2008-06-06 Thread Zachary Pincus
> I'd like to shift the columns of a 2d array one column to the right. > Is there a way to do that without making a copy? I think what you want is numpy.roll? Definition: numpy.roll(a, shift, axis=None) Docstring: Roll the elements in the array by 'shift' positions along the given

[Numpy-discussion] Inplace shift

2008-06-06 Thread Keith Goodman
I'd like to shift the columns of a 2d array one column to the right. Is there a way to do that without making a copy? This doesn't work: >> import numpy as np >> x = np.random.rand(2,3) >> x[:,1:] = x[:,:-1] >> x array([[ 0.44789223, 0.44789223, 0.44789223], [ 0.80600897, 0.80600897,