cudf.core.column.string.StringMethods.replace_with_backrefs#
- StringMethods.replace_with_backrefs(pat: str, repl: str) SeriesOrIndex[source]#
使用
repl反向引用模板创建一个新字符串,其中包含使用pat表达式找到的提取元素。- Parameters:
- patstr or compiled regex
使用分组来识别提取部分的正则表达式。 这不应该是一个编译过的正则表达式。
- replstr
包含反向引用指示符的字符串模板。
- Returns:
- Series/Index of str dtype
示例
>>> import cudf >>> s = cudf.Series(["A543","Z756"]) >>> s.str.replace_with_backrefs('(\\d)(\\d)', 'V\\2\\1') 0 AV453 1 ZV576 dtype: object