I am trying the below function.
I want to translate the data in 'Text' from the language it's in, which can be determined through
df['Language'] = df.Text.apply(lambda x: TextBlob(str(x)).detect_language())
Into Spanish, which can be done with:
.translate(from_lang='en', to= 'es')
I have tried the below, but I'm not sure how to nest the two function into a single statement?
df['Translated'] = df.Text.apply(lambda x: TextBlob(str(x)).translate(from_lang= df.Text.apply(lambda x: TextBlob(str(x))), to ='en'))
The input dataframe is just a single column with text statements, like:
Text
"I love this game, I think its great"
"really buggy, not a good experience, do not buy"
"not too bad, not too good"
Can anyone help?