Convert strings in the Series/Index to uppercase. Equivalent to :meth:`str.upper`. Returns ------- Series or Index of objects A Series or Index where the strings are modified by :meth:`str.upper`. See Also -------- Serie
(self)
| 3920 | |
| 3921 | @forbid_nonstring_types(["bytes"]) |
| 3922 | def upper(self): |
| 3923 | """ |
| 3924 | Convert strings in the Series/Index to uppercase. |
| 3925 | |
| 3926 | Equivalent to :meth:`str.upper`. |
| 3927 | |
| 3928 | Returns |
| 3929 | ------- |
| 3930 | Series or Index of objects |
| 3931 | A Series or Index where the strings are modified by :meth:`str.upper`. |
| 3932 | |
| 3933 | See Also |
| 3934 | -------- |
| 3935 | Series.str.lower : Converts all characters to lowercase. |
| 3936 | Series.str.upper : Converts all characters to uppercase. |
| 3937 | Series.str.title : Converts first character of each word to uppercase and |
| 3938 | remaining to lowercase. |
| 3939 | Series.str.capitalize : Converts first character to uppercase and |
| 3940 | remaining to lowercase. |
| 3941 | Series.str.swapcase : Converts uppercase to lowercase and lowercase to |
| 3942 | uppercase. |
| 3943 | Series.str.casefold: Removes all case distinctions in the string. |
| 3944 | |
| 3945 | Examples |
| 3946 | -------- |
| 3947 | >>> s = pd.Series(["lower", "CAPITALS", "this is a sentence", "SwApCaSe"]) |
| 3948 | >>> s |
| 3949 | 0 lower |
| 3950 | 1 CAPITALS |
| 3951 | 2 this is a sentence |
| 3952 | 3 SwApCaSe |
| 3953 | dtype: str |
| 3954 | |
| 3955 | >>> s.str.lower() |
| 3956 | 0 lower |
| 3957 | 1 capitals |
| 3958 | 2 this is a sentence |
| 3959 | 3 swapcase |
| 3960 | dtype: str |
| 3961 | |
| 3962 | >>> s.str.upper() |
| 3963 | 0 LOWER |
| 3964 | 1 CAPITALS |
| 3965 | 2 THIS IS A SENTENCE |
| 3966 | 3 SWAPCASE |
| 3967 | dtype: str |
| 3968 | |
| 3969 | >>> s.str.title() |
| 3970 | 0 Lower |
| 3971 | 1 Capitals |
| 3972 | 2 This Is A Sentence |
| 3973 | 3 Swapcase |
| 3974 | dtype: str |
| 3975 | |
| 3976 | >>> s.str.capitalize() |
| 3977 | 0 Lower |
| 3978 | 1 Capitals |
| 3979 | 2 This is a sentence |