numpy.index() in Python Last Updated : 28 Nov, 2018 Comments Improve Suggest changes Like Article Like Report 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, optional] Range to search in. Returns : An integer array with the lowest index of found sub-string, raises ValueError if substring is not found. Code #1: Python3 1== # Python Program illustrating # numpy.char.index() method import numpy as np arr = ['this is geeks for geek'] print ("arr : ", arr) print ("\nindex of 'geeks' : ", np.char.index(arr, 'geeks')) Output: arr : ['this is geeks for geek'] index of 'geeks' : [8] Code #2: Python3 1== # Python Program illustrating # numpy.char.index() method import numpy as np arr = ['this is geeks for geek'] print ("\nindex of 'geeks' : ", np.char.index(arr, 'geeks', start = 2)) print ("\nindex of 'geeks' : ", np.char.index(arr, 'geeks', start = 10)) print ("\nindex of 'geek' : ", np.char.index(arr, 'geek', start = 10)) Output: index of 'geeks' : [8] ValueError: substring not found index of 'geek' : [18] Comment More infoAdvertise with us Next Article numpy.index() in Python mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads numpy.nonzero() in Python numpy.nonzero()function is used to Compute the indices of the elements that are non-zero. It returns a tuple of arrays, one for each dimension of arr, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values in the array can be obtained with arr[nonzero(ar 2 min read 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 Python | Numpy ndarray.item() With the help of numpy.ndarray.item() method, we can fetch the data elements that is found at the given index on numpy array. Remember we can give index as one dimensional parameter or can be two dimensional. Parameters: *args : Arguments (variable number and type) -> none: This argument only works 2 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 Python NumPy Numpy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is the fundamental package for scientific computing with Python.Besides its obvious scientific uses, Numpy can also be used as an efficient m 6 min read numpy.take() in Python The numpy.take() function returns elements from array along the mentioned axis and indices. Syntax: numpy.take(array, indices, axis = None, out = None, mode ='raise') Parameters : array : array_like, input array indices : index of the values to be fetched axis : [int, optional] axis over which we ne 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 Python | Pandas Index.argmin() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.argmin() function returns the indices of the minimum value present in the 2 min read Python | Pandas Index.ndim Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.ndim attribute return the number of dimensions of the underlying data in the given Index object. By definition it is 1. Syntax: Index. 2 min read numpy.flatnonzero() in Python numpy.flatnonzero()function is used to Compute indices that are non-zero in the flattened version of arr. Syntax : numpy.flatnonzero(arr) Parameters : arr : [array_like] Input array. Return : ndarray Output array, containing the indices of the elements of arr.ravel() that are non-zero. Code #1 : Wor 1 min read Like