{ } Raw JSON

bundles / numpy 2.4.4 / numpy / strings / startswith

function

numpy.strings:startswith

source: /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_`` dtype
prefix : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
start, end : array_like, with any integer dtype

With start, test beginning at that position. With end, stop comparing at that position.

Returns

out : ndarray

Output array of bools

Examples

import numpy as np
s = np.array(['foo', 'bar'])
s
np.strings.startswith(s, 'fo')
np.strings.startswith(s, 'o', start=1, end=2)

See also

str.startswith

Aliases

  • numpy.char.startswith