nums.numpy.transpose

nums.numpy.transpose(a, axes=None)[source]

Reverse or permute the axes of an array; returns the modified array.

This docstring was copied from numpy.transpose.

Some inconsistencies with the NumS version may exist.

For an array a with two axes, transpose(a) gives the matrix transpose.

Parameters

a (BlockArray) – Input array.

Returns

pa with its axes permuted. A view is returned whenever possible.

Return type

BlockArray

Notes

Transposing a 1-D array returns an unchanged view of the original array.

axes not supported.

Examples

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> x = nps.arange(4).reshape((2,2))  
>>> x.get()  
array([[0, 1],
       [2, 3]])
>>> nps.transpose(x).get()  
array([[0, 2],
       [1, 3]])