【问题标题】:Remove accents from a python dataframe [closed]从python数据框中删除重音[关闭]
【发布时间】:2021-08-03 02:31:25
【问题描述】:

我有一个如下所示的数据框:

words
Atlántica
Común
Guión

我想从每个元素中删除所有重音符号。

我正在做的是:

from unidecode import unidecode
unidecode.unidecode(df['words'])

因此,我收到一条错误消息:

'function' object has no atribute 'unidecode'

谁能帮助我? 问候

【问题讨论】:

标签: python pandas unidecoder


【解决方案1】:

您正在导入unidecode,然后再次将其作为属性调用。试试这个:

from unidecode import unidecode
unidecode(df['words'])

根据您在尝试此操作后遇到的错误 ('Series' object hast no attribute 'encode'),我猜这应该可行:

df['words'] = df['words'].apply(unidecode)

【讨论】:

  • 当我这样做时,我收到一条消息,上面写着:'Series' object hast no attribute 'encode'
  • 您能否更清楚地说明这种情况下的数据?
  • @alelew 请检查编辑是否有效。
猜你喜欢
  • 2017-01-02
  • 2014-06-08
  • 1970-01-01
  • 2019-09-16
  • 2019-05-12
  • 1970-01-01
  • 1970-01-01
  • 2021-12-05
  • 1970-01-01
相关资源
最近更新 更多