Open In App

Numpy MaskedArray.transpose() function | Python

Last Updated : 13 Oct, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
numpy.MaskedArray.transpose() function is used to permute the dimensions of an masked array.
Syntax : numpy.ma.transpose(axis) Parameters: axis :[list of ints, optional] By default, reverse the dimensions, otherwise permute the axes according to the values given. Return : [ ndarray] Resultant array with its axes permuted..
Code #1 :
Output:
Input array :  [[ 1  2]
 [ 3 -1]
 [ 5 -3]]
Masked array :  [[-- 2]
 [3 --]
 [5 -3]]
Output transposed masked array :  [[-- 3 5]
  Code #2 :
Output:
Input array :  [[[ 2.0e+08  3.0e-05]]

 [[-4.5e+01  2.0e+05]]]
3D Masked array :  [[[-- 3e-05]]

 [[-45.0 200000.0]]]
Output transposed masked array :  [[[-- -45.0]]

 [[3e-05 200000.0]]]

Next Article
Practice Tags :

Similar Reads