【发布时间】:2018-08-28 02:43:14
【问题描述】:
我有一列句子,我是这样拆分的
df['ColTest'] = df['ColTest'].str.lower().str.split()
我要做的是遍历每个句子中的每个单词并应用 autocorrect.spell()
for i in df['ColTest']:
for j in i:
df['ColTest'][i][j].replace(at.spell(j))
这是报错
AttributeError: 'float' 对象没有属性 'replace'
自动拼写autospell
DataFrame 的样子
ColTest
This is some test string
that might contain a finger
but this string might contain a toe
and this hass a spel error
我的专栏中没有数字...请问有什么想法吗?
【问题讨论】:
-
您能分享几行数据框 df 吗?
标签: python string python-3.x pandas autocorrect