numpy.ma.MaskedArray.tolist() function - Python Last Updated : 05 May, 2020 Comments Improve Suggest changes Like Article Like Report 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 representation of the masked array. Code #1 : Python3 # Python program explaining # numpy.ma.MaskedArray.tolist() 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.tolist() print (gfg) Output : [[1, None, 3], [None, 5, None], [7, None, 9]] Code #2 : Python3 # Python program explaining # numpy.ma.MaskedArray.tolist() 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.tolist(-999) print (gfg) Output : [[1, -999, 3], [-999, 5, -999], [7, -999, 9]] Comment More infoAdvertise with us Next Article numpy.ma.MaskedArray.tolist() 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.toflex() function - Python 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. 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 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.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.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 Like