MCPcopy
hub / github.com/pandas-dev/pandas / upper

Method upper

pandas/core/strings/accessor.py:3922–3991  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 15

time_upperMethod · 0.80
_maybe_coerce_freqFunction · 0.80
_is_annualFunction · 0.80
_is_quarterlyFunction · 0.80
_is_monthlyFunction · 0.80
_is_weeklyFunction · 0.80
_str_containsMethod · 0.80
_str_upperMethod · 0.80
bdate_rangeFunction · 0.80
dtype_to_arrow_c_fmtFunction · 0.80
_convert_hex_to_excelMethod · 0.80
colorFunction · 0.80

Calls 2

_wrap_resultMethod · 0.95
_str_upperMethod · 0.45

Tested by 15

test_lower_upperFunction · 0.64
test_casemethodsFunction · 0.64
test_empty_str_methodsFunction · 0.64
test_infer_freq_rangeFunction · 0.64
test_mapMethod · 0.64
funcFunction · 0.64
test_format_index_dictFunction · 0.64