For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls :meth:`str.rsplit` element-wise. Except for splitting from the right, `rsplit` behaves like `split`. Parameters ---------- a : array-like, with ``StringDT
(a, sep=None, maxsplit=None)
| 1443 | |
| 1444 | @array_function_dispatch(_split_dispatcher) |
| 1445 | def _rsplit(a, sep=None, maxsplit=None): |
| 1446 | """ |
| 1447 | For each element in `a`, return a list of the words in the |
| 1448 | string, using `sep` as the delimiter string. |
| 1449 | |
| 1450 | Calls :meth:`str.rsplit` element-wise. |
| 1451 | |
| 1452 | Except for splitting from the right, `rsplit` |
| 1453 | behaves like `split`. |
| 1454 | |
| 1455 | Parameters |
| 1456 | ---------- |
| 1457 | a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype |
| 1458 | |
| 1459 | sep : str or unicode, optional |
| 1460 | If `sep` is not specified or None, any whitespace string |
| 1461 | is a separator. |
| 1462 | maxsplit : int, optional |
| 1463 | If `maxsplit` is given, at most `maxsplit` splits are done, |
| 1464 | the rightmost ones. |
| 1465 | |
| 1466 | Returns |
| 1467 | ------- |
| 1468 | out : ndarray |
| 1469 | Array of list objects |
| 1470 | |
| 1471 | See Also |
| 1472 | -------- |
| 1473 | str.rsplit, split |
| 1474 | |
| 1475 | Examples |
| 1476 | -------- |
| 1477 | >>> import numpy as np |
| 1478 | >>> a = np.array(['aAaAaA', 'abBABba']) |
| 1479 | >>> np.strings.rsplit(a, 'A') # doctest: +SKIP |
| 1480 | array([list(['a', 'a', 'a', '']), # doctest: +SKIP |
| 1481 | list(['abB', 'Bba'])], dtype=object) # doctest: +SKIP |
| 1482 | |
| 1483 | """ |
| 1484 | # This will return an array of lists of different sizes, so we |
| 1485 | # leave it as an object array |
| 1486 | return _vec_string( |
| 1487 | a, np.object_, 'rsplit', [sep] + _clean_args(maxsplit)) |
| 1488 | |
| 1489 | |
| 1490 | def _splitlines_dispatcher(a, keepends=None): |
nothing calls this directly
no test coverage detected
searching dependent graphs…