method
chararray.transpose(*axes)
Returns a view of the array with axes transposed.
For a 1D array this has no effect, as a transposed vector is simply the same vector. To convert a 1D array into a 2D column vector, an additional dimension must be added. np.atleast2d(a).T
achieves this, as does a[:, np.newaxis]
. For a 2D array, this is a standard matrix transpose. For an nD array, if axes are given, their order indicates how the axes are permuted (see Examples). If axes are not provided and a.shape = (i[0], i[1], ... i[n2], i[n1])
, then a.transpose().shape = (i[n1], i[n2], ... i[1], i[0])
.
Parameters: 


Returns: 

See also
ndarray.T
ndarray.reshape
>>> a = np.array([[1, 2], [3, 4]]) >>> a array([[1, 2], [3, 4]]) >>> a.transpose() array([[1, 3], [2, 4]]) >>> a.transpose((1, 0)) array([[1, 3], [2, 4]]) >>> a.transpose(1, 0) array([[1, 3], [2, 4]])
© 2005–2019 NumPy Developers
Licensed under the 3clause BSD License.
https://docs.scipy.org/doc/numpy1.17.0/reference/generated/numpy.char.chararray.transpose.html