Return an array with the elements converted to uppercase. Calls :meth:`str.upper` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype Input array. Returns
(a)
| 1084 | @set_module("numpy.strings") |
| 1085 | @array_function_dispatch(_unary_op_dispatcher) |
| 1086 | def upper(a): |
| 1087 | """ |
| 1088 | Return an array with the elements converted to uppercase. |
| 1089 | |
| 1090 | Calls :meth:`str.upper` element-wise. |
| 1091 | |
| 1092 | For 8-bit strings, this method is locale-dependent. |
| 1093 | |
| 1094 | Parameters |
| 1095 | ---------- |
| 1096 | a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype |
| 1097 | Input array. |
| 1098 | |
| 1099 | Returns |
| 1100 | ------- |
| 1101 | out : ndarray |
| 1102 | Output array of ``StringDType``, ``bytes_`` or ``str_`` dtype, |
| 1103 | depending on input types |
| 1104 | |
| 1105 | See Also |
| 1106 | -------- |
| 1107 | str.upper |
| 1108 | |
| 1109 | Examples |
| 1110 | -------- |
| 1111 | >>> import numpy as np |
| 1112 | >>> c = np.array(['a1b c', '1bca', 'bca1']); c |
| 1113 | array(['a1b c', '1bca', 'bca1'], dtype='<U5') |
| 1114 | >>> np.strings.upper(c) |
| 1115 | array(['A1B C', '1BCA', 'BCA1'], dtype='<U5') |
| 1116 | |
| 1117 | """ |
| 1118 | a_arr = np.asarray(a) |
| 1119 | return _vec_string(a_arr, a_arr.dtype, 'upper') |
| 1120 | |
| 1121 | |
| 1122 | @set_module("numpy.strings") |
no outgoing calls
no test coverage detected
searching dependent graphs…