[Numpy-discussion] Method to shift elements in an array?

Zachary Pincus zpincus at stanford.edu
Wed Feb 22 00:50:04 EST 2006


Hello folks,

Does numpy have an built-in mechanism to shift elements along some  
axis in an array? (e.g. to "roll" [0,1,2,3] by some offset, here 2,  
to make [2,3,0,1])

If not, what would be the fastest way to implement this in python?  
Using take? Using slicing and concatenation?

Zach




More information about the NumPy-Discussion mailing list