larray.Array.transpose
- Array.transpose(*args) Array [source]
Reorder axes.
By default, reverse axes, otherwise permute the axes according to the list given as argument.
- Parameters
- *args
Accepts either a tuple of axes specs or axes specs as *args. Omitted axes keep their order. Use … to avoid specifying intermediate axes.
- Returns
- Array
Array with reordered axes.
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 >>> arr.transpose('b', 'c', 'a') b c\a a0 a1 b0 c0 0 4 b0 c1 1 5 b1 c0 2 6 b1 c1 3 7 >>> arr.transpose('b') b a\c c0 c1 b0 a0 0 1 b0 a1 4 5 b1 a0 2 3 b1 a1 6 7 >>> arr.transpose(..., 'a') b c\a a0 a1 b0 c0 0 4 b0 c1 1 5 b1 c0 2 6 b1 c1 3 7 >>> arr.transpose('c', ..., 'a') c b\a a0 a1 c0 b0 0 4 c0 b1 2 6 c1 b0 1 5 c1 b1 3 7