numpy.char.endswith
-
numpy.char.endswith(a, suffix, start=0, end=None)
-
Returns a boolean array which is
True
where the string element ina
ends withsuffix
, otherwiseFalse
.Calls
str.endswith
element-wise.- Parameters
-
-
aarray_like of str or unicode
-
suffixstr
-
start, endint, optional
-
With optional
start
, test beginning at that position. With optionalend
, stop comparing at that position.
-
- Returns
-
-
outndarray
-
Outputs an array of bools.
-
See also
Examples
>>> s = np.array(['foo', 'bar']) >>> s[0] = 'foo' >>> s[1] = 'bar' >>> s array(['foo', 'bar'], dtype='<U3') >>> np.char.endswith(s, 'ar') array([False, True]) >>> np.char.endswith(s, 'a', start=1, end=2) array([False, True])
© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.19/reference/generated/numpy.char.endswith.html