numpy.unravel_index() function | Python Last Updated : 22 Apr, 2020 Comments Improve Suggest changes Like Article Like Report 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 dimensions shape. shape : [tuple of ints] The shape of the array to use for unraveling indices. 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 : [tuple of ndarray] Each array in the tuple has the same shape as the indices array. Code #1 : Python3 # Python program explaining # numpy.unravel_index() function # importing numpy as geek import numpy as geek gfg = geek.unravel_index([22, 41, 37], (7, 6)) print(gfg) Output : (array([3, 6, 6]), array([4, 5, 1])) Code #2 : Python3 # Python program explaining # numpy.unravel_index() function # importing numpy as geek import numpy as geek gfg = geek.unravel_index([22, 41, 37], (7, 6), order = 'F') print(gfg) Output : (array([1, 6, 2]), array([3, 5, 5])) Comment More infoAdvertise with us Next Article numpy.unravel_index() function | Python sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-arrayManipulation python Practice Tags : Machine Learningpython Similar Reads numpy.ravel_multi_index() function | Python 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, o 2 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.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.index() in Python numpy.core.defchararray.index(arr, substring, start=0, end=None): Finds the lowest index of the sub-string in the specified range But if substring is not found, it raises ValueError. Parameters: arr : array-like or string to be searched. substring : substring to search for. start, end : [int, option 1 min read numpy string operations | index() function numpy.core.defchararray.index(arr, sub, start=0, end=None) is another function for doing string operations in numpy. It returns the lowest index in the string where substring sub is found for each element in arr. It returns value error if sub is not contained within the range [start, end]. Parameter 2 min read numpy.who function - Python numpy.who() function print the NumPy arrays in the given dictionary. Syntax : numpy.who(vardict = None) Parameters : vardict : [dict, optional] A dictionary possibly containing ndarrays. Return : Returns âNoneâ. If there is no dictionary passed in or vardict is None then returns NumPy arrays in the 1 min read numpy.ma.clump_unmasked() function | Python numpy.ma.clump_unmasked() function returns list of slices corresponding to the unmasked clumps of a 1-D array. Syntax : numpy.ma.clump_unmasked(arr) Parameters : arr : [ndarray] A one-dimensional masked array. Return : [list of slice] The list of slices, one for each continuous region of unmasked el 1 min read Numpy ndarray.flatten() function in Python The flatten() function is used to convert a multi-dimensional NumPy array into a one-dimensional array. It creates a new copy of the data so that original array stays unchanged. If your array has rows and columns or even more dimensions, then flatten() line up every single value into a straight list 3 min read Numpy recarray.flatten() 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.reshape() in Python In Python, numpy.reshape() function is used to give a new shape to an existing NumPy array without changing its data. It is important for manipulating array structures in Python. Let's understand with an example:Pythonimport numpy as np # Creating a 1D NumPy array arr = np.array([1, 2, 3, 4, 5, 6]) 3 min read Like