pandas.Series.str.slice

pandas 3.1.1 · Series and accessors · method

Take a substring using Python-style start, stop and step positions.

Call syntax

Series.str.slice(start=None, stop=None, step=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.

step Optional
Positional or keyword
Default None
int

Set how many positions to advance between successive selections or windows.

Returns

Series or Index of object