MCPcopy Index your code
hub / github.com/numpy/numpy / rindex

Function rindex

numpy/_core/strings.py:371–401  ·  view source on GitHub ↗

Like `rfind`, but raises :exc:`ValueError` when the substring `sub` is not found. Parameters ---------- a : array-like, with ``bytes_`` or ``str_`` dtype sub : array-like, with ``bytes_`` or ``str_`` dtype start, end : array-like, with any integer dtype, optional

(a, sub, start=0, end=None)

Source from the content-addressed store, hash-verified

369
370@set_module("numpy.strings")
371def rindex(a, sub, start=0, end=None):
372 """
373 Like `rfind`, but raises :exc:`ValueError` when the substring `sub` is
374 not found.
375
376 Parameters
377 ----------
378 a : array-like, with ``bytes_`` or ``str_`` dtype
379
380 sub : array-like, with ``bytes_`` or ``str_`` dtype
381
382 start, end : array-like, with any integer dtype, optional
383
384 Returns
385 -------
386 out : ndarray
387 Output array of ints.
388
389 See Also
390 --------
391 rfind, str.rindex
392
393 Examples
394 --------
395 >>> a = np.array(["Computer Science"])
396 >>> np.strings.rindex(a, "Science", start=0, end=None)
397 array([9])
398
399 """
400 end = end if end is not None else MAX
401 return _rindex_ufunc(a, sub, start, end)
402
403
404@set_module("numpy.strings")

Callers 1

rindexMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…