cudf.core.column.string.StringMethods.match#
- StringMethods.match(pat: str, case: bool = True, flags: int = 0) SeriesOrIndex[source]#
确定每个字符串是否匹配正则表达式。
- Parameters:
- patstr or compiled regex
字符序列或正则表达式。
- flagsint, default 0 (no flags)
传递给正则表达式引擎的标志(例如 re.MULTILINE)
- Returns:
- Series or Index of boolean values.
示例
>>> import cudf >>> s = cudf.Series(["rapids", "ai", "cudf"])
检查以a开头的字符串。
>>> s.str.match('a') 0 False 1 True 2 False dtype: bool
检查以a或c开头的字符串。
>>> s.str.match('[ac]') 0 False 1 True 2 True dtype: bool