numpy.ma.MaskedArray.toflex() function - Python Last Updated : 05 May, 2020 Comments Improve Suggest changes 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.ma.MaskedArray.toflex() function - Python 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 numpy.ma.MaskedArray.count() function - Python numpy.ma.MaskedArray.count() function count the non-masked elements of the array along the given axis. Syntax : numpy.ma.MaskedArray.count(self, axis=None, keepdims = no value) Parameters : axis : [None or int or tuple of ints, optional] Axis along which the count is performed. The default axis is N 2 min read Numpy MaskedArray.var() function | Python numpy.MaskedArray.var() function is used to compute the variance along the specified axis. It returns the variance of the masked array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis. Syntax : numpy.m 3 min read numpy.ma.masked_values() function | Python numpy.ma.masked_values() function return a MaskedArray, masked where the data in array arr are approximately equal to value, determined using isclose. The default tolerances for masked_values are the same as those for isclose. Syntax : numpy.ma.masked_values(arr, value, rtol = 1e-05, atol = 1e-08, c 2 min read Numpy MaskedArray.resize() function | Python numpy.MaskedArray.resize() function is used to a make a new masked array with the specified size and shape from the given array.The new array is filled with repeated copies of arr (in the order that the data are stored in memory). If arr is masked, the new array will be masked, and the new mask will 2 min read Like