[Numpy-discussion] Inplace shift

Robert Kern robert.kern at gmail.com
Fri Jun 6 15:16:43 EDT 2008


On Fri, Jun 6, 2008 at 2:08 PM, Zachary Pincus <zachary.pincus at yale.edu> 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 effectively
copying the data.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list