Pandas Series: str.istitle() function
Series-str.istitle() function
The str.istitle() function is used to check whether all characters in each string are titlecase or not.
This is equivalent to running the Python string method str.istitle() for each element of the Series/Index. If a string has zero characters, False is returned for that check.
Syntax:
Series.str.istitle(self)
Returns: Series or Index of bool
Series or Index of boolean values with the same length as the original Series/Index.
Example:
The s.str.istitle method checks for whether all words are in title case (whether only the first letter of each word is capitalized). Words are assumed to be as any sequence of non-numeric characters separated by whitespace characters.
Python-Pandas Code:
import numpy as np
import pandas as pd
s = pd.Series(['leopard', 'Elephant', 'DEER', ''])
s.str.istitle()
Output:
0 False 1 True 2 False 3 False dtype: bool
Previous: Series-str.isupper() function
Next: Series-str.isnumeric() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/series/series-str-istitle.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics