I am trying to translate words from a Pandas dataframe column and get error in googletrans.Translator() class. It works normal with single words or phrases. Can it be environmental issue?
Any help or suggestions much appreciated
import pandas as pd
from googletrans import Translator
translator = Translator()
df = pd.DataFrame({'Spanish':['piso','cama']})
df['English'] = df['Spanish'].apply(translator.translate, src='es', dest='en').apply(getattr, args=('text',))
Output:
AttributeError: 'Translator' object has no attribute 'raise_Exception'
Hi this error occured because there is an exception occurred in the runtime. To see the error insert this below code
python translator.raise_Exception = True
If you get the error as below
Exception: Unexpected status code "429" from ['translate.google.com']
which means Too many requests. Hope you would not get this error. If so you have to upgrade you account. To avoid the error please refer this answer