pyarrow.compute.replace_substring

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

Replace non-overlapping substrings that match pattern by replacement.

For each string in strings, replace non-overlapping substrings that match pattern by replacement. If max_replacements != -1, it determines the maximum amount of replacements made, counting from the left. 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.