' rish_exception'翻译软件包中的错误
我正在尝试翻译我的数据列,称为任务和面临问题。首先,我尝试使用googletrans
import pandas as pd
import numpy as np
!pip install googletrans==4.0.0rc1
from googletrans import Translator
translator = Translator()
df['Spanish'] = df['Task'].apply(translator.translate, src='en', dest='es').apply(getattr, args=('text',))
df
有一个错误:
--> 122 if r.status_code != 200 and self.raise_Exception:
123 raise Exception('Unexpected status code "{}" from {}'.format(
124 r.status_code, self.service_urls))
AttributeError: 'Translator' object has no attribute 'raise_Exception'
guys I'm trying to translate a column of my data called Task and facing problems. First I try to use googletrans
import pandas as pd
import numpy as np
!pip install googletrans==4.0.0rc1
from googletrans import Translator
translator = Translator()
df['Spanish'] = df['Task'].apply(translator.translate, src='en', dest='es').apply(getattr, args=('text',))
df
got this error:
--> 122 if r.status_code != 200 and self.raise_Exception:
123 raise Exception('Unexpected status code "{}" from {}'.format(
124 r.status_code, self.service_urls))
AttributeError: 'Translator' object has no attribute 'raise_Exception'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加
time.sleep(1)
帮助我解决了它。Adding
time.sleep(1)
helped me resolve it.