Table Of Contents


Enter search terms or a module, class or function name.


Series.str.replace(pat, repl, n=-1, case=True, flags=0)[source]

Replace occurrences of pattern/regex in the Series/Index with some other string. Equivalent to str.replace() or re.sub().


pat : string

Character sequence or regular expression

repl : string

Replacement sequence

n : int, default -1 (all)

Number of replacements to make from start

case : boolean, default True

If True, case sensitive

flags : int, default 0 (no flags)

re module flags, e.g. re.IGNORECASE


replaced : Series/Index of objects

Scroll To Top