Returns a boolean array which is True where the string element in a starts with prefix, otherwise False.
StringDType, bytes_, or str_ dtype
StringDType, bytes_, or str_ dtype
With start, test beginning at that position. With end, stop comparing at that position.
Output array of bools
See also
>>> import numpy as np >>> s = np.array(['foo', 'bar']) >>> s array(['foo', 'bar'], dtype='<U3') >>> np.strings.startswith(s, 'fo') array([True, False]) >>> np.strings.startswith(s, 'o', start=1, end=2) array([True, False])
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.strings.startswith.html