Roll Axis Simple

import numpy as np
a = np.ones((4, 3, 2))
a
array([[[1., 1.],
        [1., 1.],
        [1., 1.]],

       [[1., 1.],
        [1., 1.],
        [1., 1.]],

       [[1., 1.],
        [1., 1.],
        [1., 1.]],

       [[1., 1.],
        [1., 1.],
        [1., 1.]]])
a.shape
(4, 3, 2)
b = np.rollaxis(a, 2)
b
array([[[1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.]],

       [[1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.]]])
b.shape
(2, 4, 3)
c = np.ones((4, 3, 2, 5, 8))
d = np.rollaxis(c, 2)
c.shape
(4, 3, 2, 5, 8)
d.shape
(2, 4, 3, 5, 8)

More: https://stackoverflow.com/questions/22583792/numpy-rollaxis-how-exactly-does-it-work