How to remove accents from values in columns?

前端 未结 4 2105
-上瘾入骨i
-上瘾入骨i 2020-12-13 07:19

How do I change the special characters to the usual alphabet letters? This is my dataframe:

In [56]: cities
Out[56]:

Table Code  Country         Year                


        
4条回答
  •  心在旅途
    2020-12-13 08:15

    With pandas series example

    def remove_accents(a):
        return unidecode.unidecode(a.decode('utf-8'))
    
    df['column'] = df['column'].apply(remove_accents)
    

    in this case decode asciis

提交回复
热议问题