cudf.core.accessors.string.StringMethods.rpartition#
- StringMethods.rpartition( ) Series | Index[source]#
Split the string at the last occurrence of sep.
This method splits the string at the last occurrence of sep, and returns 3 elements containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 elements containing two empty strings, followed by the string itself.
- Parameters:
- sepstr, default ‘ ‘ (whitespace)
String to split on.
- Returns:
- DataFrame or MultiIndex
Returns a DataFrame / MultiIndex
Notes
The parameter expand is not yet supported and will raise a NotImplementedError if anything other than the default value is set.
Examples
>>> import cudf >>> s = cudf.Series(['Linda van der Berg', 'George Pitt-Rivers']) >>> s 0 Linda van der Berg 1 George Pitt-Rivers dtype: str >>> s.str.rpartition() 0 1 2 0 Linda van der Berg 1 George Pitt-Rivers
Also available on indices:
>>> idx = cudf.Index(['X 123', 'Y 999']) >>> idx Index(['X 123', 'Y 999'], dtype='str')
Which will create a MultiIndex:
>>> idx.str.rpartition() MultiIndex([('X', ' ', '123'), ('Y', ' ', '999')], )