For each element in `a`, return a list of the lines in the element, breaking at line boundaries. Calls :meth:`str.splitlines` element-wise. Parameters ---------- a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype keepends : bool, optional Line
(a, keepends=None)
| 1493 | |
| 1494 | @array_function_dispatch(_splitlines_dispatcher) |
| 1495 | def _splitlines(a, keepends=None): |
| 1496 | """ |
| 1497 | For each element in `a`, return a list of the lines in the |
| 1498 | element, breaking at line boundaries. |
| 1499 | |
| 1500 | Calls :meth:`str.splitlines` element-wise. |
| 1501 | |
| 1502 | Parameters |
| 1503 | ---------- |
| 1504 | a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype |
| 1505 | |
| 1506 | keepends : bool, optional |
| 1507 | Line breaks are not included in the resulting list unless |
| 1508 | keepends is given and true. |
| 1509 | |
| 1510 | Returns |
| 1511 | ------- |
| 1512 | out : ndarray |
| 1513 | Array of list objects |
| 1514 | |
| 1515 | See Also |
| 1516 | -------- |
| 1517 | str.splitlines |
| 1518 | |
| 1519 | Examples |
| 1520 | -------- |
| 1521 | >>> np.char.splitlines("first line\\nsecond line") |
| 1522 | array(list(['first line', 'second line']), dtype=object) |
| 1523 | >>> a = np.array(["first\\nsecond", "third\\nfourth"]) |
| 1524 | >>> np.char.splitlines(a) |
| 1525 | array([list(['first', 'second']), list(['third', 'fourth'])], dtype=object) |
| 1526 | |
| 1527 | """ |
| 1528 | return _vec_string( |
| 1529 | a, np.object_, 'splitlines', _clean_args(keepends)) |
| 1530 | |
| 1531 | |
| 1532 | def _partition_dispatcher(a, sep): |
nothing calls this directly
no test coverage detected
searching dependent graphs…