bundles / numpy 2.4.4 / numpy / strings / index
function
numpy.strings:index
source: /numpy/_core/strings.py :336
Signature
def index ( a , sub , start = 0 , end = None ) Summary
Like find, but raises ValueError when the substring is not found.
Parameters
a: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypesub: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypestart, end: array_like, with any integer dtype, optional
Returns
out: ndarrayOutput array of ints.
Examples
import numpy as np a = np.array(["Computer Science"]) np.strings.index(a, "Science", start=0, end=None)✓
See also
- find
- str.index
Aliases
-
numpy.char.index