pandas.Series.str.rsplit

pandas 3.1.1 · Series and accessors · method

Split strings from the right, useful when limiting the number of splits.

Call syntax

Series.str.rsplit(pat=None, *, n=-1, expand=False)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
pat Optional
Positional or keyword
Default None
str

Specify the substring or regular expression to match.

n Optional
Keyword only
Default -1
int

Choose how many entries or positions to use.

expand Optional
Keyword only
Default False
bool

Choose whether to expand extracted pieces into separate columns.

Returns

Series, Index, DataFrame or MultiIndex