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

Function title

numpy/core/defchararray.py:1697–1733  ·  view source on GitHub ↗

Return element-wise title cased version of string or unicode. Title case words start with uppercase characters, all remaining cased characters are lowercase. Calls `str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ----------

(a)

Source from the content-addressed store, hash-verified

1695
1696@array_function_dispatch(_unary_op_dispatcher)
1697def title(a):
1698 """
1699 Return element-wise title cased version of string or unicode.
1700
1701 Title case words start with uppercase characters, all remaining cased
1702 characters are lowercase.
1703
1704 Calls `str.title` element-wise.
1705
1706 For 8-bit strings, this method is locale-dependent.
1707
1708 Parameters
1709 ----------
1710 a : array_like, {str, unicode}
1711 Input array.
1712
1713 Returns
1714 -------
1715 out : ndarray
1716 Output array of str or unicode, depending on input type
1717
1718 See Also
1719 --------
1720 str.title
1721
1722 Examples
1723 --------
1724 >>> c=np.array(['a1b c','1b ca','b ca1','ca1b'],'S5'); c
1725 array(['a1b c', '1b ca', 'b ca1', 'ca1b'],
1726 dtype='|S5')
1727 >>> np.char.title(c)
1728 array(['A1B C', '1B Ca', 'B Ca1', 'Ca1B'],
1729 dtype='|S5')
1730
1731 """
1732 a_arr = numpy.asarray(a)
1733 return _vec_string(a_arr, a_arr.dtype, 'title')
1734
1735
1736def _translate_dispatcher(a, table, deletechars=None):

Callers 1

titleMethod · 0.85

Calls 1

_vec_stringFunction · 0.90

Tested by

no test coverage detected