pandas.Series.str.istitle#
- Series.str.istitle()[source]#
Check whether all characters in each string are titlecase.
This is equivalent to running the Python string method
str.istitle()for each element of the Series/Index. If a string has zero characters,Falseis returned for that check.- Returns:
- Series or Index of bool
Series or Index of boolean values with the same length as the original Series/Index.
See also
Series.str.isalphaCheck whether all characters are alphabetic.
Series.str.isnumericCheck whether all characters are numeric.
Series.str.isalnumCheck whether all characters are alphanumeric.
Series.str.isdigitCheck whether all characters are digits.
Series.str.isdecimalCheck whether all characters are decimal.
Series.str.isspaceCheck whether all characters are whitespace.
Series.str.islowerCheck whether all characters are lowercase.
Series.str.isasciiCheck whether all characters are ascii.
Series.str.isupperCheck whether all characters are uppercase.
Examples
The
s5.str.istitlemethod 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.>>> s5 = pd.Series(['leopard', 'Golden Eagle', 'SNAKE', '']) >>> s5.str.istitle() 0 False 1 True 2 False 3 False dtype: bool