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

StringMethods.find_multiple(patterns: SeriesOrIndex) cudf.Series[source]#

在Series/Index中查找所有模式的首次出现。

Parameters:
patternsarray-like, Sequence or Series

在给定的Series/Index中搜索的模式。

Returns:
Series

一个包含每个模式首次出现索引列表的Series。 如果未找到模式,则返回-1作为该索引。

示例

>>> 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