bundles / numpy 2.4.4 / numpy / strings / find
function
numpy.strings:find
source: /numpy/_core/strings.py:255
Signature
def find(a, sub, start = 0, end = None)Summary
For each element, return the lowest index in the string where substring sub is found, such that sub is contained in the range [start, end).
Parameters
a: array_like, with ``StringDType``, ``bytes_`` or ``str_`` dtypesub: array_like, with `np.bytes_` or `np.str_` dtypeThe substring to search for.
start, end: array_like, with any integer dtypeThe range to look in, interpreted as in slice notation.
Returns
y: ndarrayOutput array of ints
Examples
import numpy as np a = np.array(["NumPy is a Python library"]) np.strings.find(a, "Python")✓
array([11])
See also
- str.find
Aliases
numpy.char.find