bundles / numpy latest / numpy / strings / startswith
function
numpy.strings:startswith
source: build-install/usr/lib/python3.14/site-packages/numpy/_core/strings.py:449
Signature
def startswith(a, prefix, start = 0, end = None)Summary
Returns a boolean array which is True where the string element in a starts with prefix, otherwise False.
Parameters
a: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypeprefix: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypestart, end: array_like, with any integer dtypeWith
start, test beginning at that position. Withend, stop comparing at that position.
Returns
out: ndarrayOutput array of bools
Examples
import numpy as np s = np.array(['foo', 'bar']) s✓
array(['foo', 'bar'], dtype='<U3')
np.strings.startswith(s, 'fo') np.strings.startswith(s, 'o', start=1, end=2)✗
array([ True, False])
See also
- str.startswith
Aliases
numpy.char.startswith