pandas.Series.str.normalize#

Series.str.normalize(form)[source]#

Return the Unicode normal form for the strings in the Series/Index.

For more information on the forms, see the unicodedata.normalize().

Parameters:
form{‘NFC’, ‘NFKC’, ‘NFD’, ‘NFKD’}

Unicode form.

Returns:
Series/Index of objects

A Series or Index of strings in the same Unicode form specified by form. The returned object retains the same type as the input (Series or Index), and contains the normalized strings.

See also

Series.str.upper

Convert all characters in each string to uppercase.

Series.str.lower

Convert all characters in each string to lowercase.

Series.str.title

Convert each string to title case (capitalizing the first letter of each word).

Series.str.strip

Remove leading and trailing whitespace from each string.

Series.str.replace

Replace occurrences of a substring with another substring in each string.

Examples

>>> ser = pd.Series(["ñ"])
>>> ser.str.normalize("NFC") == ser.str.normalize("NFD")
0   False
dtype: bool