MCPcopy Index your code
hub / github.com/numpy/numpy / title

Function title

numpy/_core/strings.py:1244–1282  ·  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 :meth:`str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters --------

(a)

Source from the content-addressed store, hash-verified

1242@set_module("numpy.strings")
1243@array_function_dispatch(_unary_op_dispatcher)
1244def title(a):
1245 """
1246 Return element-wise title cased version of string or unicode.
1247
1248 Title case words start with uppercase characters, all remaining cased
1249 characters are lowercase.
1250
1251 Calls :meth:`str.title` element-wise.
1252
1253 For 8-bit strings, this method is locale-dependent.
1254
1255 Parameters
1256 ----------
1257 a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
1258 Input array.
1259
1260 Returns
1261 -------
1262 out : ndarray
1263 Output array of ``StringDType``, ``bytes_`` or ``str_`` dtype,
1264 depending on input types
1265
1266 See Also
1267 --------
1268 str.title
1269
1270 Examples
1271 --------
1272 >>> import numpy as np
1273 >>> c=np.array(['a1b c','1b ca','b ca1','ca1b'],'S5'); c
1274 array(['a1b c', '1b ca', 'b ca1', 'ca1b'],
1275 dtype='|S5')
1276 >>> np.strings.title(c)
1277 array(['A1B C', '1B Ca', 'B Ca1', 'Ca1B'],
1278 dtype='|S5')
1279
1280 """
1281 a_arr = np.asarray(a)
1282 return _vec_string(a_arr, a_arr.dtype, 'title')
1283
1284
1285def _replace_dispatcher(a, old, new, count=None):

Callers 1

titleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…