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)
| 617 | |
| 618 | @array_function_dispatch(_code_dispatcher) |
| 619 | def encode(a, encoding=None, errors=None): |
| 620 | """ |
| 621 | Calls `str.encode` element-wise. |
| 622 | |
| 623 | The set of available codecs comes from the Python standard library, |
| 624 | and may be extended at runtime. For more information, see the codecs |
| 625 | module. |
| 626 | |
| 627 | Parameters |
| 628 | ---------- |
| 629 | a : array_like of str or unicode |
| 630 | |
| 631 | encoding : str, optional |
| 632 | The name of an encoding |
| 633 | |
| 634 | errors : str, optional |
| 635 | Specifies how to handle encoding errors |
| 636 | |
| 637 | Returns |
| 638 | ------- |
| 639 | out : ndarray |
| 640 | |
| 641 | See Also |
| 642 | -------- |
| 643 | str.encode |
| 644 | |
| 645 | Notes |
| 646 | ----- |
| 647 | The type of the result will depend on the encoding specified. |
| 648 | |
| 649 | """ |
| 650 | return _to_bytes_or_str_array( |
| 651 | _vec_string(a, object_, 'encode', _clean_args(encoding, errors))) |
| 652 | |
| 653 | |
| 654 | def _endswith_dispatcher(a, suffix, start=None, end=None): |
no test coverage detected