Closed octner closed 2 years ago
Hello, can you send example code in which exactly this error appears? Or can you please show the value of the translator
variable?
import pandas as pd
from translatepy.translators import GoogleTranslate
df = pd.read_csv("ru-en.csv")
translator = GoogleTranslate()
df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))
Importing the entire translatepy
gives the same result and does not change the behaviour/error message. The column is entirely in Russian and does not have any Null values.
import pandas as pd from translatepy.translators import GoogleTranslate df = pd.read_csv("ru-en.csv") translator = GoogleTranslate() df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))
Importing the entire
translatepy
gives the same result and does not change the behaviour/error message. The column is entirely in Russian and does not have any Null values.
I guess that there is quite a lot of data in ru-en.csv
?
Then, this might be why you hit the NoResult
exception quite fast.
You should always use multiple translators, using translatepy.Translate
, to avoid hitting the rate limits.
(Also, don't run the translation every time you run the program and try to save the translated data)
import pandas as pd from translatepy.translators import GoogleTranslate df = pd.read_csv("ru-en.csv") translator = GoogleTranslate() df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))
Importing the entire
translatepy
gives the same result and does not change the behaviour/error message. The column is entirely in Russian and does not have any Null values.I guess that there is quite a lot of data in
ru-en.csv
?Then, this might be why you hit the
NoResult
exception quite fast.You should always use multiple translators, using
translatepy.Translate
, to avoid hitting the rate limits.
Thanks for the reply!
I do not think that the issue is related to the amount of data though. I ran the translation separately for each column (one of the columns had approx 5x times more text with the same number of rows), and it worked. However, it refuses to translate this one and throws this "NoResult" error.
Regarding the use of multiple translators: The first time I encountered this error, I was using multiple translators, but being more specific and picking GoogleTranslate worked for me and solved the issue. However, this time neither works. Maybe there is something problematic about this column, but I do not really see how it would be different from all the others that did get translated.
How is the data at this column ? It seems weird that only this one encounters issues.
How is the data at this column ? It seems weird that only this one encounters issues.
actually there was an empty line, it's just it was buried inside the csv file and for some reason I needed to find it manually myself + a couple of other strange rows. Deleting it fixed the issue. I guess can't have any empty lines in a pandas column?
Thanks for all your help!
How is the data at this column ? It seems weird that only this one encounters issues.
actually there was an empty line, it's just it was buried inside the csv file and for some reason I needed to find it manually myself + a couple of other strange rows. Deleting it fixed the issue. I guess can't have any empty lines in a pandas column?
Thanks for all your help!
translatepy will try not to make any request when there is nothing to translate to avoid hitting rate limits
Hello,
Get "No service has returned a valid result" from time to time. Sometimes it can be fixed by explicitly specifying the languages in "translate", but sometimes it just doesn't. It refuses to translate specific columns from a data frame while works well with others.
Thanks