I have written a program that returns me the language after detection when my input is hardcoded. I want the same results after iterating over my CSV cells and print the corresponding language in the next column.
I created a code that detects language when the input is hardcoded. I now have an excel sheet with some ID's and text in different languages. I want my program to read the excel cell by cell and print the result in neighbouring column
from textblob import TextBlob
import pycountry
b = TextBlob("Si esta yayo si esta yayo alla voy ")
iso_code = b.detect_language()
# iso_code = "es"
language = pycountry.languages.get(alpha_2=iso_code)
print(language.name)
This is the Excel I want the program to iterate over
id lyric language
1 Hello how are you
2 Wie geht es dir
3 cómo estás
4 நீங்கள் எப்படி இருக்கிறீர்கள்
5 Comment vas-tu
How can I remodify my code so that I get my expected results
Expected:
id lyric language Detected Language
1 Hello how are you English
2 Wie geht es dir German
3 cómo estás Spanish
4 நீங்கள் எப்படி இருக்கிறீர்கள் Tamil
5 Comment vas-tu French