pyarrow.compute.replace_substring_regex

pyarrow.compute.replace_substring_regex(strings, *, memory_pool=None, options=None, pattern, replacement, max_replacements=- 1)

Replace non-overlapping substrings that match regex pattern by replacement.

For each string in strings, replace non-overlapping substrings that match the regular expression pattern by replacement using the Google RE2 library. If max_replacements != -1, it determines the maximum amount of replacements made, counting from the left. Note that if the pattern contains groups, backreferencing macan be used. Null values emit null.

Parameters
  • strings (Array-like or scalar-like) – Argument to compute function

  • memory_pool (pyarrow.MemoryPool, optional) – If not passed, will allocate memory from the default memory pool.

  • options (pyarrow.compute.ReplaceSubstringOptions, optional) – Parameters altering compute function semantics.

  • pattern (optional) – Parameter for ReplaceSubstringOptions constructor. Either options or pattern can be passed, but not both at the same time.

  • replacement (optional) – Parameter for ReplaceSubstringOptions constructor. Either options or replacement can be passed, but not both at the same time.

  • max_replacements (optional) – Parameter for ReplaceSubstringOptions constructor. Either options or max_replacements can be passed, but not both at the same time.