2024-06-25 22:44:11 发布
网友
我试过这个:
from autocorrect import Speller spell = Speller(lang='en') df['Text'] = df['Text'].apply(lambda x: spell(x))
但是我得到了错误:TypeError: expected string or bytes-like object
TypeError: expected string or bytes-like object
可能df['Text']中的某些值既不是str也不是bytes。试试这个:
df['Text']
str
bytes
from autocorrect import Speller spell = Speller(lang='en') df['Text'] = df['Text'].apply( lambda x: spell(x) if isinstance(x, str) or isinstance(x, bytes) else x)
可能
df['Text']
中的某些值既不是str
也不是bytes
。试试这个:相关问题 更多 >
编程相关推荐