MCPcopy Create free account
hub / github.com/numpy/numpy / rpartition

Function rpartition

numpy/core/defchararray.py:1382–1414  ·  view source on GitHub ↗

Partition (split) each element around the right-most separator. 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 af

(a, sep)

Source from the content-addressed store, hash-verified

1380
1381@array_function_dispatch(_partition_dispatcher)
1382def rpartition(a, sep):
1383 """
1384 Partition (split) each element around the right-most separator.
1385
1386 Calls `str.rpartition` element-wise.
1387
1388 For each element in `a`, split the element as the last
1389 occurrence of `sep`, and return 3 strings containing the part
1390 before the separator, the separator itself, and the part after
1391 the separator. If the separator is not found, return 3 strings
1392 containing the string itself, followed by two empty strings.
1393
1394 Parameters
1395 ----------
1396 a : array_like of str or unicode
1397 Input array
1398 sep : str or unicode
1399 Right-most separator to split each element in array.
1400
1401 Returns
1402 -------
1403 out : ndarray
1404 Output array of string or unicode, depending on input
1405 type. The output array will have an extra dimension with
1406 3 elements per input element.
1407
1408 See Also
1409 --------
1410 str.rpartition
1411
1412 """
1413 return _to_bytes_or_str_array(
1414 _vec_string(a, object_, 'rpartition', (sep,)), a)
1415
1416
1417def _split_dispatcher(a, sep=None, maxsplit=None):

Callers 1

rpartitionMethod · 0.85

Calls 2

_vec_stringFunction · 0.90
_to_bytes_or_str_arrayFunction · 0.85

Tested by

no test coverage detected