numpy.mod() in Python Last Updated : 10 Feb, 2019 Comments Improve Suggest changes Like Article Like Report numpy.mod() is another function for doing mathematical operations in numpy.It returns element-wise remainder of division between two array arr1 and arr2 i.e. arr1 % arr2 .It returns 0 when arr2 is 0 and both arr1 and arr2 are (arrays of) integers. Syntax : numpy.mod(arr1, arr2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj], ufunc 'remainder') Parameters : arr1 : [array_like] Dividend array. arr2 : [array_like] Divisor array. dtype : The type of the returned array. By default, the dtype of arr is used. out : [ndarray, optional] A location into which the result is stored. -> If provided, it must have a shape that the inputs broadcast to. -> If not provided or None, a freshly-allocated array is returned. where : [array_like, optional] Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone. **kwargs : Allows to pass keyword variable length of argument to a function. Used when we want to handle named argument in a function. Return : [ndarray] The element-wise remainder i.e arr1 % arr2 . Code #1 : Python3 # Python program explaining # numpy.mod() function import numpy as geek in_num1 = 6 in_num2 = 4 print ("Dividend : ", in_num1) print ("Divisor : ", in_num2) out_num = geek.mod(in_num1, in_num2) print ("Remainder : ", out_num) Output : Dividend : 6 Divisor : 4 Remainder : 2 Code #2 : Python3 # Python program explaining # numpy.mod() function import numpy as geek in_arr1 = geek.array([2, -4, 7]) in_arr2 = geek.array([2, 3, 4]) print ("Dividend array : ", in_arr1) print ("Divisor array : ", in_arr2) out_arr = geek.mod(in_arr1, in_arr2) print ("Output remainder array: ", out_arr) Output : Dividend array : [ 2 -4 7] Divisor array : [2 3 4] Output remainder array: [0 2 3] Comment More infoAdvertise with us Next Article numpy.mod() in Python jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads 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.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 PrimePy module in Python A prime number is a natural number greater than 1 whose only factors are 1 and the number itself. 2 is the only even Prime number. We can represent any prime number with '6n+1' or '6n-1' (except 2 and 3) where n is a natural number. primePy is that library of Python which is used to compute operatio 3 min read numpy.gcd() in Python numpy.gcd(arr1, arr2, out = None, where = True, casting = âsame_kindâ, order = âKâ, dtype = None) : This mathematical function helps user to calculate GCD value of |arr1| and |arr2| elements. Greatest Common Divisor (GCD) of two or more numbers, which are not all zero, is the largest positive number 2 min read Python | Numpy ndarray.__imod__() With the help of Numpy ndarray.__imod__(), every element in an array is operated on binary operator i.e mod(%). Remember we can use any type of values in an array and value for mod is applied as the parameter in ndarray.__imod__(). Syntax: ndarray.__imod__($self, value, /) Return: self%=value Exampl 1 min read numpy.floor() in Python The numpy.floor() function returns the largest integer less than or equal to each element in the input array. It effectively rounds numbers down to the nearest whole number. Let's understand with an example:Pythonimport numpy as np a = [0.5, 1.5, 2.5, 3, 4.5, 10.1] res = np.floor(a) print("Floored:" 1 min read Python | numpy.lookfor() method With the help of numpy.lookfor() method, we can get the information about the module in the numpy by using numpy.lookfor() method. Syntax : numpy.lookfor(module_name) Return : Return the information about the module. Example #1 : In this example we can see that by using numpy.lookfor() method, we ar 1 min read numpy.mintypecode() function â Python numpy.mintypecode() function return the character for the minimum-size type to which given types can be safely cast. Syntax : numpy.mintypecode(typechars, typeset = 'GDFgdf', default = 'd') Parameters : typechars : [list of str or array_like] If a list of strings, each string should represent a dtyp 1 min read Python | Numpy MaskedArray.__mod__ What is a mask? A boolean array, used to select only certain elements for an operation Python3 # A mask example import numpy as np x = np.arange(5) print(x) mask = (x > 2) print(mask) x[mask] = -1 print(x) Output: [0 1 2 3 4] [False False False True True] [ 0 1 2 -1 -1] numpy.ma.MaskedArray class 2 min read numpy.polydiv() in Python The numpy.polydiv() method evaluates the division of two polynomials and returns the quotient and remainder of the polynomial division. Syntax : numpy.polydiv(p1, p2) Parameters : p1 : [array_like or poly1D]Coefficients of dividend polynomial. p2 : [array_like or poly1D]Coefficients of divisor polyn 1 min read Like