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)
| 369 | |
| 370 | @set_module("numpy.strings") |
| 371 | def 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") |
no outgoing calls
no test coverage detected
searching dependent graphs…