numpy.ma.MaskedArray.toflex() function - Python Last Updated : 05 May, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report numpy.ma.MaskedArray.toflex() function transforms a masked array into a flexible-type array. The flexible type array that is returned will have two fields: the _data field and the _mask field. The _data field stores the _data part of the array and the _mask field stores the _mask part of the array. Syntax : numpy.ma.MaskedArray.toflex(self) Return : [ndarray] A new flexible-type ndarray with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape. Code #1 : Python3 # Python program explaining # numpy.ma.MaskedArray.toflex() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = geek.ma.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], mask =[0] + [1, 0]*4) gfg = arr.toflex() print (gfg) Output : [[(1, False) (2, True) (3, False)] [(4, True) (5, False) (6, True)] [(7, False) (8, True) (9, False)]] Code #2 : Python3 # Python program explaining # numpy.ma.MaskedArray.toflex() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = geek.ma.array([[11, 12, 13], [14, 15, 16], [17, 18, 19]], mask =[0] + [1, 1]*4) gfg = arr.toflex() print (gfg) Output : [[(11, False) (12, True) (13, True)] [(14, True) (15, True) (16, True)] [(17, True) (18, True) (19, True)]] Comment More infoAdvertise with us Next Article Numpy MaskedArray.transpose() function | Python S sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy python Python Numpy-Masked Array Practice Tags : Machine Learningpython Similar Reads numpy.ma.MaskedArray.tolist() function - Python numpy.ma.MaskedArray.tolist() function return the data portion of the masked array as a hierarchical Python list. Syntax : numpy.ma.MaskedArray.tolist(fill_value = None) Parameters : axis : [scalar, optional] The value to use for invalid entries. Default is None. Return : [list] The Python list repr 1 min read Numpy MaskedArray.std() function | Python numpy.MaskedArray.std() function is used to compute the standard deviation along the specified axis.Here masked entries are ignored. The standard deviation is computed for the flattened array by default, otherwise over the specified axis. Syntax : numpy.ma.std(arr, axis=None, dtype=None, out=None, d 3 min read Numpy MaskedArray.transpose() function | Python 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 2 min read Numpy MaskedArray.masked_where() function | Python In many circumstances, datasets can be incomplete or tainted by the presence of invalid data. For example, a sensor may have failed to record a data, or recorded an invalid value. The numpy.ma module provides a convenient way to address this issue, by introducing masked arrays.Masked arrays are arra 3 min read Numpy MaskedArray.ravel() function | Python numpy.MaskedArray.ravel() function is used to return a 1D version of self mask array, as a view. Syntax : numpy.ma.ravel(self, order='C') Parameters: order : [âCâ, âFâ, âAâ, âKâ, optional] By default, âCâ index order is used. --> The elements of a are read using this index order. --> âCâ means to in 2 min read Numpy MaskedArray.sum() function | Python numpy.MaskedArray.median() function is used to compute the sum of the masked array elements over the given axis. Syntax : numpy.ma.sum(arr, axis=None, dtype=None, out=None, keepdims=False) Parameters: arr : [ ndarray ] Input masked array. axis :[ int, optional] Axis along which the sum is computed. 3 min read Like