Numpy MaskedArray.getdata() - Python Last Updated : 26 Mar, 2020 Comments Improve Suggest changes Like Article Like Report numpy.ma.getdata() function is used return the data of a masked array as an ndarray. Return the data of arr as an ndarray if arr is a MaskedArray, else return arr as a ndarray or subclass if not. Syntax : numpy.ma.getdata(a, subok=True) Parameters : arr : [array_like] Input MaskedArray, alternatively a ndarray or a subclass thereof. subok : [bool] Whether to force the output to be a pure ndarray (False) or to return a subclass of ndarray if appropriate (True, default). Return : [ndarray] Return the data of a masked array as an ndarray. Code #1 : Python3 # Python program explaining # numpy.ma.getdata() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = ma.masked_equal([[2, 4], [6, 8]], 4) print("Input array : ", arr) # applying numpy.ma.getdata() method gfg = ma.getdata(arr) print("Output array : ", gfg) Output : Input array : [[2 --] [6 8]] Output array : [[2 4] [6 8]] Code #2 : Python3 # Python program explaining # numpy.ma.getdata() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = ma.masked_equal([[1, 3], [5, 8]], 5) print("Input array : ", arr) # applying numpy.ma.getdata() method gfg = ma.getdata(arr) print("Output array : ", gfg) Output : Input array : [[1 3] [-- 8]] Output array : [[1 3] [5 8]] Comment More infoAdvertise with us Next Article Numpy MaskedArray.getdata() - Python sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy python Python Numpy-Masked Array Practice Tags : Machine Learningpython Similar Reads Python | Numpy MaskedArray.__ge__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__ge__ operator we can find that which element in an array is greater than or equal to the value which is provided in the parameter. Syntax: numpy.MaskedA 1 min read Python | Numpy MaskedArray.__gt__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__gt__ operator we can find that which element in an array is greater than the value which is provided in the parameter. Syntax: numpy.MaskedArray.__gt__ 1 min read Python | Numpy MaskedArray.__eq__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__eq__ operator we can find that which element in an array is equal to the value which is provided in the parameter. Syntax: numpy.MaskedArray.__eq__ Retu 1 min read Python | Numpy MaskedArray.__lt__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__lt__ operator we can find that which element in an array is less than the value which is provided in the parameter. Syntax: numpy.MaskedArray.__lt__ Ret 1 min read Python | Numpy MaskedArray.__le__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__le__ operator we can find that which element in an array is less than or equal to the value which is provided in the parameter. Syntax: numpy.MaskedArra 1 min read Python | Numpy MaskedArray.__and__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__and__ method we can get the elements that is anded by the value that is provided as a parameter. Syntax: numpy.MaskedArray.__and__ Return: Return self 1 min read Python | Numpy MaskedArray.__add__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__add__ we can add a particular value that is provided as a parameter in the MaskedArray.__add__() method. Value will be added to each and every element i 1 min read Python | Numpy MaskedArray.__abs__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__abs__ operator we can find the absolute value of each and every element in an array. Suppose we have a values 31.74, with the help of MaskedArray.__abs_ 1 min read Python | Numpy MaskedArray.__div__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__div__ we can divide a particular value that is provided as a parameter in the MaskedArray.__div__() method. Syntax: numpy.MaskedArray.__div__ Return: Di 1 min read Python | Numpy MaskedArray.__lshift__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__lshift__ method we can get the elements that is left shifted by the value that is provided as a parameter. Syntax: numpy.MaskedArray.__lshift__ Return: 1 min read Like