numpy.ma.make_mask() function | Python Last Updated : 20 Jun, 2021 Comments Improve Suggest changes Like Article Like Report numpy.ma.make_mask() function is used to create a boolean mask from an array. This function can accept any sequence that is convertible to integers, or nomask. It does not require that contents must be 0s and 1s, values of 0 are interpreted as False, everything else as True. Return m as a boolean mask. Syntax : numpy.ma.make_mask(m, copy = False, shrink = True, dtype = bool )Parameters : arr : [ array_like] Potential mask. copy : [bool, optional] Whether to return a copy of m (True) or m itself (False). shrink : [bool, optional] Whether to shrink m to nomask if all its values are False. dtype : [dtype, optional] Data-type of the output mask. By default, the output mask has a dtype of MaskType (bool).Return : [ndarray] A boolean mask derived from m. Code #1 : Python3 # Python program explaining # numpy.ma.make_mask() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma m = [1, 1, 0, 1] gfg = ma.make_mask(m) print (gfg) Output : [ True True False True] Code #2 : Python3 # Python program explaining # numpy.ma.make_mask() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma m = [2, -3, 0, 1] gfg = ma.make_mask(m) print (gfg) Output : [ True True False True] Code #3 : Python3 # Python program explaining # numpy.ma.make_mask() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma m = [True, True, True, False] gfg = ma.make_mask(m) print (gfg) Output : [ True True True False] Comment More infoAdvertise with us Next Article numpy.ma.make_mask() 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.make_mask_none() function | Python numpy.ma.make_mask_none() function return a boolean mask of the given shape, filled with False. This function returns a boolean ndarray with all entries False, that can be used in common mask manipulations. If a complex dtype is specified, the type of each field is converted to a boolean type. Synta 1 min read numpy.ma.is_mask() function | Python numpy.ma.is_mask() function return True if parameter m is a valid, standard mask. This function does not check the contents of the input, only that the type is MaskType. In particular, this function returns False if the mask has a flexible dtype. Syntax : numpy.ma.is_mask(m) Parameter : m : [array_l 1 min read numpy.ma.mask_or() function | Python numpy.ma.mask_or() function combine two masks with the logical_or operator. The result may be a view on m1 or m2 if the other is nomask (i.e. False). Syntax : numpy.ma.mask_or(m1, m2, copy = False, shrink = True) Parameters : m1, m2 : [ array_like] Input masks. copy : [bool, optional] If copy is Fal 2 min read numpy.ma.is_masked() function | Python numpy.ma.is_masked() function determine whether input has masked values & accepts any object as input, but always returns False unless the input is a MaskedArray containing masked values. Syntax : numpy.ma.is_masked(arr) Parameters : arr : [array_like] Array to check for masked values. Return : 1 min read numpy.ma.mask_rows() function | Python In this numpy.ma.mask_rows() function, mask rows of a 2D array that contain masked values. This function is a shortcut to mask_rowcols with axis equal to 0. Syntax : numpy.ma.mask_rows(arr, axis = None) Parameters : arr : [array_like, MaskedArray] The array to mask. The result is a MaskedArray. axis 2 min read Like