Return an array with the elements converted to uppercase. Calls `str.upper` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ------- out : ndarray, {str, unicod
(a)
| 1776 | |
| 1777 | @array_function_dispatch(_unary_op_dispatcher) |
| 1778 | def upper(a): |
| 1779 | """ |
| 1780 | Return an array with the elements converted to uppercase. |
| 1781 | |
| 1782 | Calls `str.upper` element-wise. |
| 1783 | |
| 1784 | For 8-bit strings, this method is locale-dependent. |
| 1785 | |
| 1786 | Parameters |
| 1787 | ---------- |
| 1788 | a : array_like, {str, unicode} |
| 1789 | Input array. |
| 1790 | |
| 1791 | Returns |
| 1792 | ------- |
| 1793 | out : ndarray, {str, unicode} |
| 1794 | Output array of str or unicode, depending on input type |
| 1795 | |
| 1796 | See Also |
| 1797 | -------- |
| 1798 | str.upper |
| 1799 | |
| 1800 | Examples |
| 1801 | -------- |
| 1802 | >>> c = np.array(['a1b c', '1bca', 'bca1']); c |
| 1803 | array(['a1b c', '1bca', 'bca1'], dtype='<U5') |
| 1804 | >>> np.char.upper(c) |
| 1805 | array(['A1B C', '1BCA', 'BCA1'], dtype='<U5') |
| 1806 | |
| 1807 | """ |
| 1808 | a_arr = numpy.asarray(a) |
| 1809 | return _vec_string(a_arr, a_arr.dtype, 'upper') |
| 1810 | |
| 1811 | |
| 1812 | def _zfill_dispatcher(a, width): |