how to loop through python data set?
Hi there, I'm a bit stuck on how to use the panda data set when running some python scripts.
The base idea is to use some python script that allows me to check what language an example is written in. I have recordsets that contain out of a title field and some other fields, in a variety of languages. I use python to check which language the title is in, filter on English and ignore the rest.
Below is the (simplified) code I use :
This works pretty fine if I filter my dataset to a single row, but if I send multiple rows they all are assigned the same language. So this this means I need to itterate through the data, but I fail to make it work. I used a few ways (including below) but always get a meaningless parse error so i am a bit stuck. What would be the correct way to itterate through the panda data set, apply the change to each row, and then return the set?
This did not work :
for row in data.iterrows():
rl = msc.detect_lang(row["title_field"])
rl = "undefined"