MCPcopy Create free account
hub / github.com/numpy/numpy / upper

Function upper

numpy/core/defchararray.py:1778–1809  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1776
1777@array_function_dispatch(_unary_op_dispatcher)
1778def 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
1812def _zfill_dispatcher(a, width):

Callers 1

upperMethod · 0.85

Calls 1

_vec_stringFunction · 0.90

Tested by

no test coverage detected