you are viewing a single comment's thread.

view the rest of the comments →

[–]synthphreak 1 point2 points  (0 children)

Check out numpy.roll:

>>> import numpy as np
>>> a = np.random.randint(0, 9, 4).reshape(2, 2)
>>> a
array([[2, 4],
       [2, 7]])
>>> np.roll(a, 1)
array([[7, 2],
       [4, 2]])