numpy.ma.filled() function - Python Last Updated : 05 May, 2020 Comments Improve Suggest changes Like Article Like Report numpy.ma.filled() function return input as an array with masked data replaced by a fill value. If arr is not a MaskedArray, arr itself is returned. If arr is a MaskedArray and fill_value is None, fill_value is set to arr.fill_value. Syntax : numpy.ma.filled(arr, fill_value = None) Parameters : arr : [MaskedArray or array_like] An input object. fill_value : [scalar, optional] Filling value. Default is None. Return : [ndarray] The filled array. Code #1 : Python3 # Python program explaining # numpy.ma.filled() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = geek.ma.array(geek.arange(4).reshape(2, 2), mask =[[1, 0], [0, 1]]) gfg = arr.filled() print (gfg) Output : [[999999 1] [ 2 999999]] Code #2 : Python3 # Python program explaining # numpy.ma.filled() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = geek.ma.array(geek.arange(9).reshape(3, 3), mask =[[1, 0, 0], [1, 0, 0], [0, 0, 0]]) gfg = arr.filled() print (gfg) Output : [[999999 1 2] [999999 4 5] [ 6 7 8]] Comment More infoAdvertise with us Next Article numpy.ma.filled() 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.append() function | Python numpy.ma.append() function append the values to the end of an array. Syntax : numpy.ma.append(arr1, arr2, axis = None) Parameters : arr1 : [array_like] Values are appended to a copy of this array. arr2 : [array_like] Values are appended to a copy of this array. If axis is not specified, arr2 can be 2 min read numpy.ma.choose() function - Python numpy.ma.choose() function use an index array to construct a new array from a set of choices. Given an array of integers and a set of n choice arrays, this method will create a new array that merges each of the choice arrays. Where arr value in arr is i, the new array will have the value that choice 2 min read numpy.ma.masked_all() function | Python numpy.ma.masked_all() function return an empty masked array of the given shape and dtype, where all the data are masked. Syntax : numpy.ma.masked_all(shape, dtype) Parameter : shape : [tuple] Shape of the required MaskedArray. dtype : [dtype, optional] Data type of the output. Return : [MaskedArray] 1 min read numpy.ma.fix_invalid() function | Python numpy.ma.fix_invalid() function return input with invalid data masked and replaced by a fill value. Where invalid data means values of nan, inf, etc. Syntax : numpy.ma.fix_invalid(arr, mask = False, copy = True, fill_value = None) Parameter : arr : [array_like] Input array. mask : [sequence, optiona 2 min read numpy.ma.mask_cols() function | Python In thisnumpy.ma.mask_cols() function, mask columns of a 2D array that contain masked values. This function is a shortcut to mask_rowcols with axis equal to 1. Syntax : numpy.ma.mask_cols(arr, axis = None) Parameters : arr : [array_like, MaskedArray] The array to mask. axis : [int, optional] Axis alo 1 min read numpy.matlib.empty() function | Python numpy.matlib.empty() function return a new matrix of given shape and type, without initializing entries. Syntax : numpy.matlib.empty(shape, dtype = None, order = 'C') Parameters : shape : [int or tuple of int] Shape of the empty matrix. dtype : [data-type, optional] Desired output data-type. order : 1 min read numpy.ma.where() function - Python numpy.ma.where() function return a masked array with elements from x or y, depending on condition. Syntax : numpy.ma.where(condition, x, y) Parameter : condition : [array_like, bool] Where True, yield x, otherwise yield y. x, y : [array_like, optional] Values from which to choose. x, y and condition 1 min read Numpy recarray.fill() function | Python In numpy, arrays may have a data-types containing fields, analogous to columns in a spreadsheet. An example is [(a, int), (b, float)], where each entry in the array is a pair of (int, float). Normally, these attributes are accessed using dictionary lookups such as arr['a'] and arr['b']. Record array 2 min read Numpy MaskedArray.all() 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 arr 3 min read Numpy MaskedArray.allequal() 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 Like