numpy.ravel_multi_index() function | Python Last Updated : 22 Apr, 2020 Comments Improve Suggest changes Like Article Like Report numpy.ravel_multi_index() function converts a tuple of index arrays into an array of flat indices, applying boundary modes to the multi-index. Syntax : numpy.ravel_multi_index(multi_index, dims, mode = 'raise', order = 'C) Parameters : multi_index : [tuple of array_like] A tuple of integer arrays, one array for each dimension. dims : [tuple of ints] The shape of array into which the indices from multi_index apply. mode : [{‘raise’, ‘wrap’, ‘clip’}, optional] Specifies how out-of-bounds indices are handled. Can specify either one mode or a tuple of modes, one mode per index. ‘raise’ – raise an error (default) ‘wrap’ – wrap around ‘clip’ – clip to the range In ‘clip’ mode, a negative index that would normally wrap will clip to 0 instead. order : [{‘C’, ‘F’}, optional] Determines whether the multi-index should be viewed as indexing in row-major (C-style) or column-major (Fortran-style) order. Return : [ndarray] An array of indices into the flattened version of an array of dimensions dims. Code #1 : Python3 # Python program explaining # numpy.ravel_multi_index() function # importing numpy as geek import numpy as geek arr = geek.array([[3, 6, 6], [4, 5, 1]]) gfg = geek.ravel_multi_index(arr, (7, 6)) print(gfg) Output : [22 41 37] Code #2 : Python3 # Python program explaining # numpy.ravel_multi_index() function # importing numpy as geek import numpy as geek arr = geek.array([[3, 6, 6], [4, 5, 1]]) gfg = geek.ravel_multi_index(arr, (7, 6), order = 'F') print(gfg) Output : [31 41 13] Code #3 : Python3 # Python program explaining # numpy.ravel_multi_index() function # importing numpy as geek import numpy as geek arr = geek.array([[3, 6, 6], [4, 5, 1]]) gfg = geek.ravel_multi_index(arr, (7, 6), mode = 'clip') print(gfg) Output : [22 41 37] Comment More infoAdvertise with us Next Article numpy.ravel_multi_index() function | Python sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-arrayManipulation python Practice Tags : Machine Learningpython Similar Reads numpy.unravel_index() function | Python numpy.unravel_index() function converts a flat index or array of flat indices into a tuple of coordinate arrays. Syntax : numpy.unravel_index(indices, shape, order = 'C') Parameters : indices : [array_like] An integer array whose elements are indices into the flattened version of an array of dimensi 1 min read numpy.tril_indices() function | Python numpy.tril_indices() function return the indices for the lower-triangle of an (n, m) array. Syntax : numpy.tril_indices(n, k = 0, m = None) Parameters : n : [int] The row dimension of the arrays for which the returned indices will be valid. k : [int, optional] Diagonal offset. m : [int, optional] Th 1 min read numpy.char.multiply() function in Python The multiply() method of the char class in the NumPy module is used for element-wise string multiple concatenation. numpy.char.multiply()Syntax : numpy.char.multiply(a, i)Parameters : a : array of str or unicodei : number of times to be repeatedReturns : Array of strings Example 1 : Using the method 1 min read numpy.mask_indices() function | Python numpy.mask_indices() function return the indices to access (n, n) arrays, given a masking function. Syntax : numpy.mask_indices(n, mask_func, k = 0) Parameters : n : [int] The returned indices will be valid to access arrays of shape (n, n). mask_func : [callable] A function whose call signature is s 1 min read numpy.ix_() function | Python numpy.ix_() function construct an open mesh from multiple sequences. This function takes N 1-D sequences and returns N outputs with N dimensions each, such that the shape is 1 in all but one dimension and the dimension with the non-unit shape value cycles through all N dimensions. Syntax : numpy.ix_ 1 min read Numpy MaskedArray.ravel() function | Python numpy.MaskedArray.ravel() function is used to return a 1D version of self mask array, as a view. Syntax : numpy.ma.ravel(self, order='C') Parameters: order : [âCâ, âFâ, âAâ, âKâ, optional] By default, âCâ index order is used. --> The elements of a are read using this index order. --> âCâ means to in 2 min read numpy.matlib.zeros() function | Python numpy.matlib.zeros() function return matrix of given shape and type, filled with zeros. Syntax : numpy.matlib.zeros(shape, dtype = None, order = 'C') Parameters : shape : [sequence of ints] Shape of the empty matrix. dtype : [data-type, optional] The desired data-type for the matrix, default is floa 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 Numpy recarray.ravel() 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 Numpy size() function | Python numpy.size() function in Python is used to count the number of elements in a NumPy array. You can use it to get the total count of all elements, or to count elements along a specific axis, such as rows or columns in a multidimensional array. This makes it useful when quickly trying to understand the 2 min read Like