pandas.Series.str.slice_replace

pandas 3.1.1 · Series and accessors · method

Replace the section of each string between two character positions.

Call syntax

Series.str.slice_replace(start=None, stop=None, repl=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
start Optional
Positional or keyword
Default None
int

Supply the start point of a range, slice, or calculation.

stop Optional
Positional or keyword
Default None
int

Provide the endpoint where a slice or generated range stops.

repl Optional
Positional or keyword
Default None
str

Returns

Series or Index