strings.index(a, sub, start=0, end=None)
Like
, but raises
when the substring is not found.
Parameters:aarray-like, with StringDType, bytes_, or str_ dtypesubarray-like, with StringDType, bytes_, or str_ dtypestart, endarray_like, with any integer dtype, optionalReturns:outndarrayOutput array of ints.
Examples
>>> importnumpyasnp>>> a=np.array(["Computer Science"])>>> np.strings.index(a,"Science",start=0,end=None)array([9])