numpy.put() in Python Last Updated : 08 Mar, 2024 Comments Improve Suggest changes Like Article Like Report The numpy.put() function replaces specific elements of an array with given values of p_array. Array indexed works on flattened array. Syntax: numpy.put(array, indices, p_array, mode = 'raise') Parameters : array : array_like, target array indices : index of the values to be fetched p_array : array_like, values to be placed in target array mode : [{‘raise’, ‘wrap’, ‘clip’}, optional] mentions how out-of-bound indices will behave raise : [default]raise an error wrap : wrap around clip : clip to the range Python # Python Program explaining # numpy.put() import numpy as geek a = geek.arange(5) geek.put(a, [0, 2], [-44, -55]) print("After put : \n", a) Output : After put : [-44, 1, -55, 3, 4] Python # Python Program explaining # numpy.put() import numpy as geek a = geek.arange(5) geek.put(a, 22, -5, mode='clip') print("After put : \n", a) Output : array([ 0, 1, 2, 3, -5]) Note : These codes won't run on online IDE's. So please, run them on your systems to explore the working. Comment More infoAdvertise with us Next Article numpy.put() in Python M Mohit Gupta_OMG Improve Article Tags : Python Python-numpy Python numpy-Indexing Practice Tags : python Similar Reads 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.add() in Python NumPy, the Python powerhouse for scientific computing, provides an array of tools to efficiently manipulate and analyze data. Among its key functionalities lies numpy.add() a potent function that performs element-wise addition on NumPy arrays. numpy.add() SyntaxSyntax : numpy.add(arr1, arr2, /, out= 4 min read Python NumPy Numpy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is the fundamental package for scientific computing with Python.Besides its obvious scientific uses, Numpy can also be used as an efficient m 6 min read numpy.load() in Python numpy.load() function return the input array from a disk file with npy extension(.npy). Syntax : numpy.load(file, mmap_mode=None, allow_pickle=True, fix_imports=True, encoding='ASCII') Parameters: file : : file-like object, string, or pathlib.Path.The file to read. File-like objects must support the 2 min read NumPy Array in Python NumPy (Numerical Python) is a powerful library for numerical computations in Python. It is commonly referred to multidimensional container that holds the same data type. It is the core data structure of the NumPy library and is optimized for numerical and scientific computation in Python. Table of C 2 min read Python | numpy.putmask() method 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 w 1 min read Numpy recarray.put() 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 3 min read Input and Output in Python Understanding input and output operations is fundamental to Python programming. With the print() function, we can display output in various formats, while the input() function enables interaction with users by gathering input during program execution. Taking input in PythonPython input() function is 8 min read Python input() Function Python input() function is used to take user input. By default, it returns the user input in form of a string.input() Function Syntax: input(prompt)prompt [optional]: any string value to display as input messageEx: input("What is your name? ")Returns: Return a string value as input by the user.By de 4 min read numpy.multiply() in Python The numpy.multiply() is a numpy function in Python which is used to find element-wise multiplication of two arrays or scalar (single value). It returns the product of two input array element by element.Syntax:numpy.multiply(arr1, arr2, out=None, where=True, casting='same_kind', order='K', dtype=None 3 min read Like