numpy.strings.rindex#

strings.rindex(a, sub, start=0, end=None)[source]#

Like rfind, but raises ValueError when the substring sub is not found.

Parameters:
aarray-like, with np.bytes_ or np.str_ dtype
subarray-like, with np.bytes_ or np.str_ dtype
start, endarray-like, with any integer dtype, optional
Returns:
outndarray

Output array of ints.

See also

rfind, str.rindex

Examples

>>> a = np.array(["Computer Science"])
>>> np.strings.rindex(a, "Science", start=0, end=None)
array([9])