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_`` dtypeInput array
sep: str or unicodeRight-most separator to split each element in array.
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_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