Numpy string operations | rindex() function Last Updated : 29 Aug, 2020 Comments Improve Suggest changes Like Article Like Report numpy.core.defchararray.rindex() function, raises ValueError when the substring sub is not found. Calls str.rindex element-wise. Syntax : numpy.core.defchararray.rindex(arr, sub, start = 0, end = None) Parameters : arr : [array-like of str or unicode] Array-like of str . sub : [str or unicode] Input string or unicode. start, end : [int, optional] Optional arguments start and end are interpreted as in slice notation. Return : Return the output array of ints. Code #1 : Python3 # Python program explaining # numpy.char.rindex() function # importing numpy as geek import numpy as geek arr = "GeeksforGeeks - A computer science portal for geeks" sub = 'science' gfg = geek.char.rindex(arr, sub) print (gfg) Output : 27 Code #2 : Python3 # Python program explaining # numpy.char.rindex() function # importing numpy as geek import numpy as geek arr = "GeeksforGeeks - A computer science portal for geeks" sub = 'geeks' gfg = geek.char.rindex(arr, sub, start = 0, end = None) print (gfg) Output : 46 Create Quiz Comment S sanjoy_62 Follow 0 Improve S sanjoy_62 Follow 0 Improve Article Tags : Numpy Python-numpy Python numpy-String Operation Explore IntroductionNumPy Introduction5 min readPython NumPy6 min readNumPy Array in Python2 min readBasics of NumPy Arrays4 min readNumpy - ndarray3 min readData type Object (dtype) in NumPy Python3 min readCreating NumPy ArrayNumpy - Array Creation5 min readnumpy.arange() in Python2 min readnumpy.zeros() in Python2 min readNumPy - Create array filled with all ones2 min readNumPy - linspace() Function2 min readnumpy.eye() in Python2 min readCreating a one-dimensional NumPy array2 min readHow to create an empty and a full NumPy array2 min readCreate a Numpy array filled with all zeros - Python2 min readHow to generate 2-D Gaussian array using NumPy?2 min readHow to create a vector in Python using NumPy4 min readPython - Numpy fromrecords() method2 min readNumPy Array ManipulationNumPy Copy and View of Array4 min readHow to Copy NumPy array into another array?2 min readAppending values at the end of an NumPy array4 min readHow to swap columns of a given NumPy array?4 min readInsert a new axis within a NumPy array4 min readnumpy.hstack() in Python2 min readnumpy.vstack() in python2 min readJoining NumPy Array3 min readCombining a One and a Two-Dimensional NumPy Array3 min readNumpy np.ma.concatenate() method-Python2 min readNumpy dstack() method-Python2 min readSplitting Arrays in NumPy6 min readHow to compare two NumPy arrays?2 min readFind the union of two NumPy arrays2 min readFind unique rows in a NumPy array3 min readNumpy np.unique() method-Python2 min readnumpy.trim_zeros() in Python2 min read Like