Python | Numpy np.ediff1d() method Last Updated : 02 Dec, 2019 Comments Improve Suggest changes Like Article Like Report With the help of np.ediff1d() method, we can get the 1D array of differences between two consecutive elements by using np.ediff1d() method. Syntax : np.ediff1d(array) Return : Return 1D array having differences of consecutive elements. Example #1 : In this example we can see that by using np.ediff1d() method, we are able to get the 1D array of consecutive differences of the elements of an array using this method. Python3 1=1 # import numpy import numpy as np # using np.ediff1d() method arr = np.array([1, 2, 3, 5, 7, 11]) gfg = np.ediff1d(arr) print(gfg) Output : [1 1 2 2 4] Example #2 : Python3 1=1 # import numpy import numpy as np # using np.ediff1d() method arr = np.array([1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) gfg = np.ediff1d(arr) print(gfg) Output : [1 1 2 2 4 2 4 2 4 6 2 6 4 2 4] Comment More infoAdvertise with us Next Article Python | Numpy np.ediff1d() method J Jitender_1998 Follow Improve Article Tags : Python Python-numpy Practice Tags : python Similar Reads Python | Numpy np.eigvals() method With the help of np.eigvals() method, we can get the eigen values of a matrix by using np.eigvals() method. Syntax : np.eigvals(matrix) Return : Return the eigen values of a matrix. Example #1 : In this example we can see that by using np.eigvals() method, we are able to get the eigen values of a ma 1 min read Python | Numpy np.hermeone() method With the help of np.hermeone() method, we can use hermeone instead of np.ones() by using np.hermeone() method. Syntax : np.hermeone Return : Return the array of ones. Example #1 : In this example we can see that by using np.hermeone() method, we are able to get the functionality of np.ones as same a 1 min read numpy.ma.ediff1d() function in Python numpy.ma.ediff1d() function return the differences between consecutive elements of an array. Syntax : numpy.ma.ediff1d(arr, to_end = None, to_begin = None) Parameters : arr : [array_like] Input array. to_end : [array_like, optional] Number to append at the end of the returned differences. to_begin 1 min read numpy.atleast_1d() in Python numpy.atleast_1d()function is used when we want to Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved. Syntax : numpy.atleast_1d(*arrays) Parameters : arrays1, arrays2, ... : [array_like] One or mo 2 min read numpy.linalg.eig() Method in Python In NumPy we can compute the eigenvalues and right eigenvectors of a given square array with the help of numpy.linalg.eig(). It will take a square array as a parameter and it will return two values first one is eigenvalues of the array and second is the right eigenvectors of a given square array. Syn 1 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.eye() in Python numpy.eye() is a function in the NumPy library that creates a 2D array with ones on the diagonal and zeros elsewhere. This function is often used to generate identity matrices with ones along the diagonal and zeros in all other positions.Let's understand with the help of an example:Pythonimport nump 2 min read numpy.ceil() in Python The numpy.ceil() is a mathematical function that returns the ceil of the elements of array. The ceil of the scalar x is the smallest integer i, such that i >= x Syntax : numpy.ceil(x[, out]) = ufunc âceilâ) Parameters : a : [array_like] Input array Return : The ceil of each element with float dat 2 min read numpy.ldexp() in Python In Python, numpy.ldexp(arr1, arr2[, out]) function returns arr1 * (2**arr2), element-wise. This is also called as inverse of numpy.frexp() function. Syntax: numpy.ldexp()Parameters: arr1: [array_like] Array of multipliers. arr2: [array_like, int] Array of twos exponents. out: [ndarray, optional] Out 1 min read numpy.expm1() in Python numpy.expm1(array, out = None, where = True, casting = 'same_kind', order = 'K', dtype = None) : This mathematical function helps user to calculate exponential of all the elements subtracting 1 from all the input array elements. Parameters : array : [array_like]Input array or object whose elements, 2 min read Like