Skip to main content
`Ctrl`+`K`

# numpy.strings.index

strings.index(a, sub, start=0, end=None)

  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.

  See also

  `find`, `str.index`

  Examples

      >>> import numpy as np
      >>> a = np.array(["Computer Science"])
      >>> np.strings.index(a, "Science", start=0, end=None)
      array([9])