numpy.ma.ediff1d() function in Python Last Updated : 12 Nov, 2020 Comments Improve Suggest changes Like Article Like Report 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 : [array_like, optional] Number to prepend at the beginning of the returned differences. Return : Return the differences between consecutive elements of an array. Code #1: Python3 # Python program explaining # numpy.ma.ediff1d() function # importing numpy as geek import numpy as geek arr = geek.array([3, 5, 8, 4, 12]) gfg = geek.ma.ediff1d(arr) print(gfg) Output: [ 2 3 -4 8] Code #2: Python3 # Python program explaining # numpy.ma.ediff1d() function # importing numpy as geek import numpy as geek arr = geek.array([3, 5, 8, 4, 12]) gfg = geek.ma.ediff1d(arr, to_begin=geek.array([-23, 0]), to_end=25) print(gfg) Output: [-23 0 2 3 -4 8 25] Comment More infoAdvertise with us Next Article numpy.ma.ediff1d() function in Python code_hunt Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads Numpy matrix.I function | Python With the help ofnumpy.matrix.I() function we can get the multiplicative inverse of the same size as of our given matrix. Syntax : numpy.matrix.I() Return : [matrix object] If self is non-singular, ret is such that ret * self == self * ret == np.matrix(np.eye(self[0, :].size) all return True. Return 1 min read numpy.i0() function | Python numpy.i0() function is the modified Bessel function of the first kind, order 0. it's usually denoted by I0. Syntax : numpy.i0(x) Parameters : x : [array_like, dtype float or complex] Argument of the Bessel function. Return : [ndarray, shape = x.shape, dtype = x.dtype] The modified Bessel function ev 1 min read Python | Numpy np.ediff1d() method 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 1 min read numpy.finfo() function â Python numpy.finfo() function shows machine limits for floating point types. Syntax : numpy.finfo(dtype) Parameters : dtype : [float, dtype, or instance] Kind of floating point data-type about which to get information. Return : Machine parameters for floating point types. Code #1 : Python3 # Python program 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 numpy.ma.flatnotmasked_edges() function | Python numpy.ma.flatnotmasked_edges() function find the indices of the first and last unmasked values. Syntax : numpy.ma.flatnotmasked_edges(arr) Parameters : arr : [ array_like] Input 1-D MaskedArray. Return : [ndarray or None] The indices of first and last non-masked value in the array. Returns None if a 1 min read numpy.identity() in Python numpy.identity() function is used to create an identity matrix which is used to make identity matrix. This is commonly used in linear algebra and numerical computations. It has the following properties:Diagonal elements are all 1s.Non-diagonal elements are all 0s.Syntax: numpy.identity(n, dtype=None 1 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 numpy matrix operations | eye() function numpy.matlib.eye() is another function for doing matrix operations in numpy. It returns a matrix with ones on the diagonal and zeros elsewhere. Syntax : numpy.matlib.eye(n, M=None, k=0, dtype='float', order='C') Parameters : n : [int] Number of rows in the output matrix. M : [int, optional] Number o 2 min read Numpy MaskedArray.anom() function | Python In many circumstances, datasets can be incomplete or tainted by the presence of invalid data. For example, a sensor may have failed to record a data, or recorded an invalid value. The numpy.ma module provides a convenient way to address this issue, by introducing masked arrays.Masked arrays are arra 2 min read Like