pandas.Series.str.rpartition

pandas 3.1.1 · Series and accessors · method

Split into three parts at the last occurrence of a separator.

Call syntax

Series.str.rpartition(sep=' ', expand=True)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
sep Optional
Positional or keyword
Default ' '
str

Specify the separator between fields or string pieces.

expand Optional
Positional or keyword
Default True
bool

Choose whether to expand extracted pieces into separate columns.

Returns

DataFrame/MultiIndex or Series/Index of objects