larray.Array.reverse

Array.reverse(axes=None) Array[source]

Reverse axes of an array.

Parameters
axesint, str, Axis or any combination of those

axes to reverse. If None, all axes are reversed. Defaults to None.

Returns
Array

Array with passed axes reversed.

Examples

>>> arr = ndtest((2, 2, 2))
>>> arr
 a  b\c  c0  c1
a0   b0   0   1
a0   b1   2   3
a1   b0   4   5
a1   b1   6   7

Reverse one axis

>>> arr.reverse('c')
 a  b\c  c1  c0
a0   b0   1   0
a0   b1   3   2
a1   b0   5   4
a1   b1   7   6

Reverse several axes

>>> arr.reverse(('a', 'c'))
 a  b\c  c1  c0
a1   b0   5   4
a1   b1   7   6
a0   b0   1   0
a0   b1   3   2

Reverse all axes

>>> arr.reverse()
 a  b\c  c1  c0
a1   b1   7   6
a1   b0   5   4
a0   b1   3   2
a0   b0   1   0