numpy.ma.mask_rowcols() function | Python Last Updated : 22 Apr, 2020 Comments Improve Suggest changes Like Article Like Report In this numpy.ma.mask_rowcols() function, mask rows and/or columns of a 2D array that contain masked values. The masking behavior is selected using the axis parameter. If axis is None, rows and columns are masked. If axis is 0, only rows are masked. If axis is 1 or -1, only columns are masked. Syntax : numpy.ma.mask_rowcols(arr, axis = None) Parameters : arr : [array_like, MaskedArray] The array to mask. The result is a MaskedArray with mask set to nomask (False). Must be a 2D array. axis : [int, optional] Axis along which to perform the operation. Default is None. Return : [MaskedArray] A modified version of the input array, masked depending on the value of the axis parameter. Code #1 : Python3 # Python program explaining # numpy.ma.mask_rowcols() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = geek.zeros((4, 4), dtype = int) arr[2, 2] = 1 arr = ma.masked_equal(arr, 1) gfg = ma.mask_rowcols(arr) print (gfg) Output : [[0 0 -- 0] [0 0 -- 0] [-- -- -- --] [0 0 -- 0]] Code #2 : Python3 # Python program explaining # numpy.ma.mask_rowcols() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = geek.zeros((5, 5), dtype = int) arr[3, 3] = 1 arr = ma.masked_equal(arr, 1) gfg = ma.mask_rowcols(arr) print (gfg) Output : [[0 0 0 -- 0] [0 0 0 -- 0] [0 0 0 -- 0] [-- -- -- -- --] [0 0 0 -- 0]] Comment More infoAdvertise with us Next Article numpy.ma.mask_rowcols() function | Python S sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-arrayManipulation python Python Numpy-Masked Array +1 More Practice Tags : Machine Learningpython Similar Reads 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 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.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_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_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 Like