Incorrect number of rows for ios data after Removing Non-English Names Part Two

Screen Link: Learn data science with Python and R projects

My Code:

def string_check(string):
    sum = 0
    
    for i in string:
        if ord(i) > 127:
            sum += 1
            
    if sum > 3:
        return False
    else:
        return True
play_english = []
ios_english = []

for i in android_clean:
    name = i[0]
    if string_check(name):
        play_english.append(i)
        
for i in ios_data:
    name = i[0]
    if string_check(name):
        ios_english.append(i)
        
        
explore_data(play_english, 0, 5, True)
explore_data(ios_english, 0, 5, True)

What I expected to happen:

I expected the the number of rows after removing non-English apps to be the same as in the solution notebook, i.e. 9614 and 6183 for play and ios data sets respectively.

What actually happened:

The play data set results in the expected number of rows after removing non-English apps, i.e. 9614.
However, when parsing the ios data set through, the data set remains unchanged, i.e. the number of rows remains at 7197

['Photo Editor & Candy Camera & Grid & ScrapBook', 'ART_AND_DESIGN', '4.1', '159', '19M', '10,000+', 'Free', '0', 'Everyone', 'Art & Design', 'January 7, 2018', '1.0.0', '4.0.3 and up']


['U Launcher Lite – FREE Live Cool Themes, Hide Apps', 'ART_AND_DESIGN', '4.7', '87510', '8.7M', '5,000,000+', 'Free', '0', 'Everyone', 'Art & Design', 'August 1, 2018', '1.2.4', '4.0.3 and up']


Number of rows: 9614
Number of colums: 13
['284882215', 'Facebook', '389879808', 'USD', '0.0', '2974676', '212', '3.5', '3.5', '95.0', '4+', 'Social Networking', '37', '1', '29', '1']


['389801252', 'Instagram', '113954816', 'USD', '0.0', '2161558', '1289', '4.5', '4.0', '10.23', '12+', 'Photo & Video', '37', '0', '29', '1']


Number of rows: 7197
Number of colums: 16

Any help would be greatly appreciated!

I would recommend looking at the dataset columns again and checking which column corresponds to the name of the app in both datasets. That should help you out. If not, feel free to ask more questions.

And thank you for writing such a detailed and structured post! :pray:t4:

1 Like

Aha!! Rookie mistake :blush: thanks so much. I spent a good while searching for a simple mistake but I missed that.

For anyone interested, here’s the corrected (and working) code:

play_english = []
ios_english = []

for i in android_clean:
    name = i[0]
    if string_check(name):
        play_english.append(i)
        
for i in ios_data:
    name = i[1] # This is the line that needed changing to fix the error
    if string_check(name):
        ios_english.append(i)
        
        
explore_data(play_english, 0, 5, True)
explore_data(ios_english, 0, 5, True)