numpy.ma.masked_array.transpose¶
method

masked_array.
transpose
(*axes)[源代码]¶ Returns a view of the array with axes transposed.
For a 1D array, this has no effect. (To change between column and row vectors, first cast the 1D array into a matrix object.) For a 2D array, this is the usual 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])
, thena.transpose().shape = (i[n1], i[n2], ... i[1], i[0])
.Parameters:  axes : None, tuple of ints, or n ints
 None or no argument: reverses the order of the axes.
 tuple of ints: i in the jth place in the tuple means a’s ith axis becomes a.transpose()’s jth axis.
 n ints: same as an ntuple of the same ints (this form is intended simply as a “convenience” alternative to the tuple form)
Returns:  out : ndarray
View of a, with axes suitably permuted.
参见
ndarray.T
 Array property returning the array transposed.
Examples
>>> 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]])