Problems translating a pandas dataframe from english to french using googletrans

Viewed 238

I am using googlentrans to translate a column from a dataframe.

translator = Translator()  # initalize the Translator object

data['phrase']=data['sentence'].apply(lambda x: translator.translate(x, src='en', dest='fr').text )

It is supposed to work, but after I applying these 2 lines of code I am creating a column called "phrase" but is not in french. The text remains in english...

I have also used this line of code

data['phrase']=data['sentence'].apply(translator.translate, src='en',dest='fr').apply(getattr,args=('text',))

And the problem remains the same, it seems like google trans is not applying the translation.

Best,

0 Answers
Related