This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / char / rpartition

function

numpy.char:rpartition

source: build-install/usr/lib/python3.14/site-packages/numpy/_core/defchararray.py :360

Signature

def   rpartition ( a sep )

Summary

Partition (split) each element around the right-most separator.

Extended Summary

Calls str.rpartition element-wise.

For each element in a, split the element as the last occurrence of sep, and return 3 strings containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 strings containing the string itself, followed by two empty strings.

Parameters

a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype

Input array

sep : str or unicode

Right-most separator to split each element in array.

Returns

out : ndarray

Output array of StringDType, bytes_ or str_ dtype, depending on input types. The output array will have an extra dimension with 3 elements per input element.

Examples

import numpy as np
a = np.array(['aAaAaA', '  aA  ', 'abBABba'])
np.char.rpartition(a, 'A')

See also

str.rpartition

Aliases

  • numpy.char.rpartition