Python | numpy.putmask() method Last Updated : 03 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report With the help of numpy.putmask() method, we can change the elements in an array with the help of condition and given value by using numpy.putmask() method. Syntax : numpy.putmask(array, condition, value) Return : Return the array having new elements according to value. Example #1 : In this example we can see that by using numpy.putmask() method, we are able to get the new array with the help of a given condition and value. Python3 1=1 # import numpy import numpy as np # using numpy.putmask() method arr = np.array([1, 2, 3, 4, 5, 6]) np.putmask(arr, arr % 2 == 0, 0) print(arr) Output : array([1, 0, 3, 0, 5, 0]) Example #2 : Python3 1=1 # import numpy import numpy as np # using numpy.putmask() method arr = np.array([[1, 2, 3], [3, 2, 1], [1, 2, 3]]) np.putmask(arr, arr>2, 4) print(arr) Output : [[1 2 4] [4 2 1] [1 2 4]] Comment More infoAdvertise with us Next Article Python | Numpy MaskedArray.__pow__ J jitender_1998 Follow Improve Article Tags : Technical Scripter Python Python-numpy Practice Tags : python Similar Reads Python | numpy.ma.ids() method With the help of numpy.ma.ids() method, we can get the address of masked array having data by using numpy.ma.ids() method. Syntax : numpy.ma.ids(array, mask) Return : Return the address of masked array. Example #1 : In this example we can see that by using numpy.ma.ids() method, we are able to get t 1 min read Python | Numpy getmask() method With the help of numpy.getmask() method, we can get the masked matrix of numpy array which shows masked values by using numpy.getmask() method. Syntax : numpy.getmask(array) Return : Return masked values of a matrix. Example #1 : In this example we can see that by using numpy.getmask() method, we ar 1 min read numpy.place() in Python The numpy.place() method makes changes in the array according the parameters - conditions and value(uses first N-values to put into array as per the mask being set by the user). It works opposite to numpy.extract(). Syntax: numpy.place(array, mask, vals) Parameters : array : [ndarray] Input array, w 2 min read numpy.pad() function in Python numpy.pad() function is used to pad the Numpy arrays. Sometimes there is a need to perform padding in Numpy arrays, then numPy.pad() function is used. The function returns the padded array of rank equal to the given array and the shape will increase according to pad_width. Syntax: numpy.pad(array, p 2 min read Python | Numpy MaskedArray.__pow__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__pow__ method we can get the elements powered with the value that is provided as a parameter. Syntax: numpy.MaskedArray.__pow__ Return: Raise self to the 1 min read python | Numpy masked_equal() method With the help of numpy.ma.masked_equal() method, we can get the mask a value that in an array by using numpy.ma.masked_equal() method. Syntax : numpy.ma.masked_equal(array, value) Return : Return the array after removing mask value. Example #1 : In this example we can see that by using numpy.ma.mask 1 min read Like