Created
August 10, 2018 05:45
-
-
Save rileypeterson/447c1dc405264a09d1e67a7db675b369 to your computer and use it in GitHub Desktop.
Google translate applied to pandas Series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from googletrans import Translator | |
import pandas as pd | |
translator = Translator() | |
df = pd.DataFrame({'Spanish':['piso','cama']}) | |
df['English'] = df['Spanish'].apply(translator.translate, src='es', dest='en').apply(getattr, args=('text',)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment