Calls `str.encode` element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the codecs module. Parameters ---------- a : array_like of str or unicode encoding : str, optional
(a, encoding=None, errors=None)
| 566 | |
| 567 | @array_function_dispatch(_code_dispatcher) |
| 568 | def encode(a, encoding=None, errors=None): |
| 569 | """ |
| 570 | Calls `str.encode` element-wise. |
| 571 | |
| 572 | The set of available codecs comes from the Python standard library, |
| 573 | and may be extended at runtime. For more information, see the codecs |
| 574 | module. |
| 575 | |
| 576 | Parameters |
| 577 | ---------- |
| 578 | a : array_like of str or unicode |
| 579 | |
| 580 | encoding : str, optional |
| 581 | The name of an encoding |
| 582 | |
| 583 | errors : str, optional |
| 584 | Specifies how to handle encoding errors |
| 585 | |
| 586 | Returns |
| 587 | ------- |
| 588 | out : ndarray |
| 589 | |
| 590 | See also |
| 591 | -------- |
| 592 | str.encode |
| 593 | |
| 594 | Notes |
| 595 | ----- |
| 596 | The type of the result will depend on the encoding specified. |
| 597 | |
| 598 | """ |
| 599 | return _to_string_or_unicode_array( |
| 600 | _vec_string(a, object_, 'encode', _clean_args(encoding, errors))) |
| 601 | |
| 602 | |
| 603 | def _endswith_dispatcher(a, suffix, start=None, end=None): |
no test coverage detected