numpy.char.endswith#
- char.endswith(a, suffix, start=0, end=None)[source]#
Returns a boolean array which is True where the string element in
a
ends withsuffix
, otherwise False.- Parameters:
- aarray-like, with
StringDType
,bytes_
, orstr_
dtype - suffixarray-like, with
StringDType
,bytes_
, orstr_
dtype - start, endarray_like, with any integer dtype
With
start
, test beginning at that position. Withend
, stop comparing at that position.
- aarray-like, with
- Returns:
- outndarray
Output array of bools
See also
Examples
>>> import numpy as np >>> s = np.array(['foo', 'bar']) >>> s array(['foo', 'bar'], dtype='<U3') >>> np.strings.endswith(s, 'ar') array([False, True]) >>> np.strings.endswith(s, 'a', start=1, end=2) array([False, True])