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)
| 1606 | |
| 1607 | @array_function_dispatch(_unary_op_dispatcher) |
| 1608 | def title(a): |
| 1609 | """ |
| 1610 | Return element-wise title cased version of string or unicode. |
| 1611 | |
| 1612 | Title case words start with uppercase characters, all remaining cased |
| 1613 | characters are lowercase. |
| 1614 | |
| 1615 | Calls `str.title` element-wise. |
| 1616 | |
| 1617 | For 8-bit strings, this method is locale-dependent. |
| 1618 | |
| 1619 | Parameters |
| 1620 | ---------- |
| 1621 | a : array_like, {str, unicode} |
| 1622 | Input array. |
| 1623 | |
| 1624 | Returns |
| 1625 | ------- |
| 1626 | out : ndarray |
| 1627 | Output array of str or unicode, depending on input type |
| 1628 | |
| 1629 | See also |
| 1630 | -------- |
| 1631 | str.title |
| 1632 | |
| 1633 | Examples |
| 1634 | -------- |
| 1635 | >>> c=np.array(['a1b c','1b ca','b ca1','ca1b'],'S5'); c |
| 1636 | array(['a1b c', '1b ca', 'b ca1', 'ca1b'], |
| 1637 | dtype='|S5') |
| 1638 | >>> np.char.title(c) |
| 1639 | array(['A1B C', '1B Ca', 'B Ca1', 'Ca1B'], |
| 1640 | dtype='|S5') |
| 1641 | |
| 1642 | """ |
| 1643 | a_arr = numpy.asarray(a) |
| 1644 | return _vec_string(a_arr, a_arr.dtype, 'title') |
| 1645 | |
| 1646 | |
| 1647 | def _translate_dispatcher(a, table, deletechars=None): |