NumPy: title() function
numpy.core.defchararray.title() function
The numpy.core.defchararray.title() function returns 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.
Version: 1.15.0
Syntax:
numpy.core.defchararray.title(a)
Parameter:
Name | Description | Required / Optional |
---|---|---|
a: array_like, {str, unicode} | Input array. | Required |
Return value:
out [ndarray] Output array of str or unicode, depending on input type.
Example-1: numpy.title() function
>>> import numpy as np
>>> x=np.array(['a1b c','1b ca','b ca1','ca1b'],'S5'); x
array([b'a1b c', b'1b ca', b'b ca1', b'ca1b'], dtype='|S5')
>>> np.char.title(x)
array([b'A1B C', b'1B Ca', b'B Ca1', b'Ca1B'], dtype='|S5')
Pictorial Presentation:
Example-2: numpy.title() function
>>> import numpy as np
>>> x = np.array('the quick brown fox');
>>> x
array('the quick brown fox', dtype='<U19')
>>> np.char.title(x)
array('The Quick Brown Fox', dtype='<U19')
Pictorial Presentation:
Python - NumPy Code Editor:
Previous:
swapcase()
Next:
translate()
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework