cudf.core.column.string.StringMethods.find_multiple#

StringMethods.find_multiple(patterns: SeriesOrIndex) cudf.Series#

Find all first occurrences of patterns in the Series/Index.

Parameters:
patternsarray-like, Sequence or Series

Patterns to search for in the given Series/Index.

Returns:
Series

A Series with a list of indices of each pattern’s first occurrence. If a pattern is not found, -1 is returned for that index.

Examples

>>> import cudf
>>> s = cudf.Series(["strings", "to", "search", "in"])
>>> s
0    strings
1         to
2     search
3         in
dtype: object
>>> t = cudf.Series(["a", "string", "g", "inn", "o", "r", "sea"])
>>> t
0         a
1    string
2         g
3       inn
4         o
5         r
6       sea
dtype: object
>>> s.str.find_multiple(t)
0       [-1, 0, 5, -1, -1, 2, -1]
1     [-1, -1, -1, -1, 1, -1, -1]
2       [2, -1, -1, -1, -1, 3, 0]
3    [-1, -1, -1, -1, -1, -1, -1]
dtype: list