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
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?
>>>
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
>>
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.
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
> 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
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,