Returns a boolean array which is `True` where the string element in ``a`` ends with ``suffix``, otherwise `False`. Parameters ---------- a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype suffix : array-like, with ``StringDType``, ``bytes_``, or ``str_`` d
(a, suffix, start=0, end=None)
| 489 | |
| 490 | @set_module("numpy.strings") |
| 491 | def endswith(a, suffix, start=0, end=None): |
| 492 | """ |
| 493 | Returns a boolean array which is `True` where the string element |
| 494 | in ``a`` ends with ``suffix``, otherwise `False`. |
| 495 | |
| 496 | Parameters |
| 497 | ---------- |
| 498 | a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype |
| 499 | |
| 500 | suffix : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype |
| 501 | |
| 502 | start, end : array_like, with any integer dtype |
| 503 | With ``start``, test beginning at that position. With ``end``, |
| 504 | stop comparing at that position. |
| 505 | |
| 506 | Returns |
| 507 | ------- |
| 508 | out : ndarray |
| 509 | Output array of bools |
| 510 | |
| 511 | See Also |
| 512 | -------- |
| 513 | str.endswith |
| 514 | |
| 515 | Examples |
| 516 | -------- |
| 517 | >>> import numpy as np |
| 518 | >>> s = np.array(['foo', 'bar']) |
| 519 | >>> s |
| 520 | array(['foo', 'bar'], dtype='<U3') |
| 521 | >>> np.strings.endswith(s, 'ar') |
| 522 | array([False, True]) |
| 523 | >>> np.strings.endswith(s, 'a', start=1, end=2) |
| 524 | array([False, True]) |
| 525 | |
| 526 | """ |
| 527 | end = end if end is not None else MAX |
| 528 | return _endswith_ufunc(a, suffix, start, end) |
| 529 | |
| 530 | |
| 531 | def _code_dispatcher(a, encoding=None, errors=None): |
no outgoing calls
no test coverage detected
searching dependent graphs…