Convert strings in the Series/Index to titlecase. Equivalent to :meth:`str.title`. Returns ------- Series or Index of objects A Series or Index where the strings are modified by :meth:`str.title`. See Also -------- Serie
(self)
| 3992 | |
| 3993 | @forbid_nonstring_types(["bytes"]) |
| 3994 | def title(self): |
| 3995 | """ |
| 3996 | Convert strings in the Series/Index to titlecase. |
| 3997 | |
| 3998 | Equivalent to :meth:`str.title`. |
| 3999 | |
| 4000 | Returns |
| 4001 | ------- |
| 4002 | Series or Index of objects |
| 4003 | A Series or Index where the strings are modified by :meth:`str.title`. |
| 4004 | |
| 4005 | See Also |
| 4006 | -------- |
| 4007 | Series.str.lower : Converts all characters to lowercase. |
| 4008 | Series.str.upper : Converts all characters to uppercase. |
| 4009 | Series.str.title : Converts first character of each word to uppercase and |
| 4010 | remaining to lowercase. |
| 4011 | Series.str.capitalize : Converts first character to uppercase and |
| 4012 | remaining to lowercase. |
| 4013 | Series.str.swapcase : Converts uppercase to lowercase and lowercase to |
| 4014 | uppercase. |
| 4015 | Series.str.casefold: Removes all case distinctions in the string. |
| 4016 | |
| 4017 | Examples |
| 4018 | -------- |
| 4019 | >>> s = pd.Series(["lower", "CAPITALS", "this is a sentence", "SwApCaSe"]) |
| 4020 | >>> s |
| 4021 | 0 lower |
| 4022 | 1 CAPITALS |
| 4023 | 2 this is a sentence |
| 4024 | 3 SwApCaSe |
| 4025 | dtype: str |
| 4026 | |
| 4027 | >>> s.str.lower() |
| 4028 | 0 lower |
| 4029 | 1 capitals |
| 4030 | 2 this is a sentence |
| 4031 | 3 swapcase |
| 4032 | dtype: str |
| 4033 | |
| 4034 | >>> s.str.upper() |
| 4035 | 0 LOWER |
| 4036 | 1 CAPITALS |
| 4037 | 2 THIS IS A SENTENCE |
| 4038 | 3 SWAPCASE |
| 4039 | dtype: str |
| 4040 | |
| 4041 | >>> s.str.title() |
| 4042 | 0 Lower |
| 4043 | 1 Capitals |
| 4044 | 2 This Is A Sentence |
| 4045 | 3 Swapcase |
| 4046 | dtype: str |
| 4047 | |
| 4048 | >>> s.str.capitalize() |
| 4049 | 0 Lower |
| 4050 | 1 Capitals |
| 4051 | 2 This is a sentence |