- DataArray.str.replace(pat, repl, n=-1, case=None, flags=0, regex=True)#
Replace occurrences of pattern/regex in the array with some string.
If pat, repl, or ‘n` is array-like, they are broadcast against the array and applied elementwise.
callable()or array-like of
callable()) – Replacement string or a callable. The callable is passed the regex match object and must return a replacement string to be used. See
re.sub(). If array-like, it is broadcast.
0) – Flags to pass through to the re module, e.g. re.IGNORECASE. see compilation-flags.
0means no flags. Flags can be combined with the bitwise or operator
|. Cannot be set if pat is a compiled regex.
True) – If True, assumes the passed-in pattern is a regular expression. If False, treats the pattern as a literal string. Cannot be set to False if pat is a compiled regex or repl is a callable.
same type as values) – A copy of the object with all matching occurrences of pat replaced by repl.