This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / strings / index

function

numpy.strings:index

source: build-install/usr/lib/python3.14/site-packages/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_`` dtype
sub : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
start, end : array_like, with any integer dtype, optional

Returns

out : ndarray

Output 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