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 M 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 returns the indices of the elements in an array that are non-zero. It is commonly used to find the positions of non-zero (or True) elements in arrays.Example:Pythonimport numpy as np a = np.array([0, 2, 0, 3, 0, 4]) res = np.nonzero(a) print(res)Output(array([1, 3, 5]),) Exp 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 Like