pandas.Series.str.replace — pandas 1.2.4 documentation | pandas columns replace
Replaceeachoccurrenceofpattern/regexintheSeries/Index.Equivalenttostr.replace()[1]orre.sub()[2],dependingontheregexvalue.ParameterspatstrorcompiledregexStringcanbeacharactersequenceorregularexpression.replstrorcallableReplacementstringoracallable.Thecallableispassedtheregexmatchobjectandmustreturnareplacementstringtobeused.Seere.sub()[3].nint,default-1(all)Numberofreplacementstomakefromstart.casebool,defaultNoneDeterminesifreplaceiscasesensitive:IfTrue,casesensitive(thedefaultifpatisastring)...
Replace each occurrence of pattern/regex in the Series/Index.
Equivalent to str.replace()[1] or re.sub()[2], depending on the regex value.
Parameters patstr or compiled regexString can be a character sequence or regular expression.
replstr or callableReplacement string or a callable. The callable is passed the regex match object and must return a replacement string to be used. See re.sub()[3].
nint, default -1 (all)Number of replacements to make from start.
casebool, default NoneDetermines if replace is case sensitive:
If True, case sensitive (the default if pat is a string)
Set to False for case insensitive
Cannot be set if pat is a compiled regex.
flagsint, default 0 (no flags)Regex module flags, e.g. re.IGNORECASE. Cannot be set if pat is a compiled regex.
regexbool, default TrueDetermines if the passed-in pattern is a regular expression:
If True, assumes the passed-in pattern is a regular expressio...