Guided projects

Screen Link:
https://app.dataquest.io/m/350/guided-project%3A-profitable-app-profiles-for-the-app-store-and-google-play-markets/10/most-common-apps-by-genre-part-two

My Code:

def freq_table(dataset,index):
    temp={}
    for key in dataset:
        duck=key[index]
        if duck in temp:
            temp[duck]+=1
        else:
            temp[duck]=1
    for x in temp:
        temp[x]=((temp[x]/len(dataset))*100)
    return temp    

def display_table(dataset, index):
    table = freq_table(dataset, index)
    table_display = []
    for key in table:
        key_val_as_tuple = (table[key], key)
        table_display.append(key_val_as_tuple)

    table_sorted = sorted(table_display, reverse = True)
    for entry in table_sorted:
        print(entry[1], ':', entry[0])
print(display_table(android,1))            

What I expected to happen:
Just usual output as the solution shows.

What actually happened:

Well,I get an Extra None at the end.

FAMILY : 18.907942238267147
GAME : 9.724729241877256
TOOLS : 8.461191335740072
BUSINESS : 4.591606498194946
LIFESTYLE : 3.9034296028880866
PRODUCTIVITY : 3.892148014440433
FINANCE : 3.7003610108303246
MEDICAL : 3.531137184115524
SPORTS : 3.395758122743682
PERSONALIZATION : 3.3167870036101084
COMMUNICATION : 3.2378158844765346
HEALTH_AND_FITNESS : 3.0798736462093865
PHOTOGRAPHY : 2.944494584837545
NEWS_AND_MAGAZINES : 2.7978339350180503
SOCIAL : 2.6624548736462095
TRAVEL_AND_LOCAL : 2.33528880866426
SHOPPING : 2.2450361010830324
BOOKS_AND_REFERENCE : 2.1435018050541514
DATING : 1.861462093862816
VIDEO_PLAYERS : 1.7937725631768955
MAPS_AND_NAVIGATION : 1.3989169675090252
FOOD_AND_DRINK : 1.2409747292418771
EDUCATION : 1.1620036101083033
ENTERTAINMENT : 0.9589350180505415
LIBRARIES_AND_DEMO : 0.9363718411552346
AUTO_AND_VEHICLES : 0.9250902527075812
HOUSE_AND_HOME : 0.8235559566787004
WEATHER : 0.8009927797833934
EVENTS : 0.7107400722021661
PARENTING : 0.6543321299638989
ART_AND_DESIGN : 0.6430505415162455
COMICS : 0.6204873646209386
BEAUTY : 0.5979241877256317
None

For the Android apps dataset, why do we have to take the column ‘Category’ into account? Why can’t we calculate using ‘Genre’ only,like the ios dataset?

This is because you are trying to use print on a function that does not have a return statement -

print(display_table(android,1))

Your display_table() function only has print in it, and no return statement. So, when you use print on the function itself, Python also prints out a None at the end.

You can take just the Genre column like the Apple dataset. But looking at the frequency table obtained via Category can provide us with additional insights as Category seems to be related to or relevant to Genre. It’s always better to try and understand relationship between columns and what insights we can gather from them instead of focusing on just one at a time.