Project 1: Filter non-English apps from data

Hello,

I have set up the function for filtering out the non-English apps and it seems to be working when I test it on example strings. Once I apply the function to the Apple/Google datasets, I can an unexpected outcome which includes random number of columns and strange output.

Any thoughts?

My Apple/Google Data work fine up until the previous step of the project.


Code (slightly different names from the solution):

English_Android_apps =
English_Apple_apps =

for app in android_clean:
name = app[0]
if is_full_English(name):
English_Android_apps.append(name)

for app in Apple_data:
name = app[1]
if is_full_English(name):
English_Apple_apps.append(name)

explore_data(English_Android_apps, 0, 3, True)
explore_data(English_Apple_apps, 0, 3, True)

Output:

Photo Editor & Candy Camera & Grid & ScrapBook

U Launcher Lite – FREE Live Cool Themes, Hide Apps

Sketch - Draw & Paint

Number of rows: 9614
Number of columns: 46
track_name

Facebook

Instagram

Number of rows: 6184
Number of columns: 10


Many thanks,
Kostas

@Kostas, could you, please, format your code with code snippet (this symbol in post editing: </>).
Also, it would be nice to have a look at your is_full_English() function code.

1 Like

thanks @ranklord.

Please see below. Hope it works now.

def is_full_English(x):
    count = 0
    for letter in x:
        if ord(letter) > 127:
            count += 1
    if count > 3:
        return False
    else:
        return True

print(is_full_English('Docs To Go™ Free Office Suite'))
print(is_full_English('Instachat 😜'))
print(is_full_English('爱奇艺PPS -《欢乐颂2》电视剧热播'))  



English_Android_apps = [] 
English_Apple_apps = []

for app in android_clean:
    name = app[0]
    if is_full_English(name):
        English_Android_apps.append(name)

for app in Apple_data:
    name = app[1]
    if is_full_English(name):
        English_Apple_apps.append(name)
        
explore_data(English_Android_apps, 0, 3, True)
explore_data(English_Apple_apps, 0, 3, True)

Sorry for the deluge, I figured it out. I should have been appending the ‘app’ row, so my code above is incorrect.

Thanks anyway.

1 Like

Congrats! There is no feeling better than winning over your own bugs :slight_smile:
No irony, I am dead serious.