Partition (split) each element around the right-most separator.
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.
StringDType, bytes_, or str_ dtype
Input array
StringDType, bytes_, or str_ dtype
Separator to split each string element in a.
StringDType, bytes_ or str_ dtype with the part before the separatorStringDType, bytes_ or str_ dtype with the separatorStringDType, bytes_ or str_ dtype with the part after the separatorSee also
>>> import numpy as np >>> a = np.array(['aAaAaA', ' aA ', 'abBABba']) >>> np.strings.rpartition(a, 'A') (array(['aAaAa', ' a', 'abB'], dtype='<U5'), array(['A', 'A', 'A'], dtype='<U1'), array(['', ' ', 'Bba'], dtype='<U3'))
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.strings.rpartition.html