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 / strings / rpartition

_ArrayFunctionDispatcher

numpy.strings:rpartition

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

Signature

def   rpartition ( a sep )

Summary

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

Extended Summary

For each element in a, split the element at the last occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, the third item of the tuple will contain the whole string, and the first and second ones will be the empty string.

Parameters

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

Input array

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

Separator to split each string element in a.

Returns

out : 3-tuple:
  • array with StringDType, bytes_ or str_ dtype with the part before the separator

  • array with StringDType, bytes_ or str_ dtype with the separator

  • array with StringDType, bytes_ or str_ dtype with the part after the separator

Examples

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

See also

str.rpartition

Aliases

  • numpy.strings.rpartition