numpy.char.chararray.mT — NumPy v2.6.dev0 Manual

attribute

char.chararray.mT

#

View of the matrix transposed array.

The matrix transpose is the transpose of the last two dimensions, even if the array is of higher dimension.

Added in version 2.0.

Raises:ValueErrorIf the array is of dimension less than 2.

Examples

>>> importnumpyasnp>>> a=np.array([[1,2],[3,4]])>>> aarray([[1, 2], [3, 4]])>>> a.mTarray([[1, 3], [2, 4]])>>> a=np.arange(8).reshape((2,2,2))>>> aarray([[[0, 1], [2, 3]], [[4, 5], [6, 7]]])>>> a.mTarray([[[0, 2], [1, 3]], [[4, 6], [5, 7]]])