Profitable apps : user ratings
Looking at the list below, and referencing the code ‘app[5]’ I count 5 from the left to find ratings but this is ‘0.0’, so I do not think this is the ratings for ioS? I have trouble seeing where the ratings come for the genre.
I see that genre_app = app[-5] corresponds to the text genre i.e ‘Games’
but I only see ‘0.0’ for app[5] in this list
[‘389801252’, ‘Instagram’, ‘113954816’, ‘USD’, ‘0.0’, ‘2161558’, ‘1289’, ‘4.5’, ‘4.0’, ‘10.23’, ‘12+’, ‘Photo & Video’, ‘37’, ‘0’, ‘29’, ‘1’]
[‘529479190’, ‘Clash of Clans’, ‘116476928’, ‘USD’, ‘0.0’, ‘2130805’, ‘579’, ‘4.5’, ‘4.5’, ‘9.24.12’, ‘9+’, ‘Games’, ‘38’, ‘5’, ‘18’, ‘1’]
I have trouble understanding the calculation for average games :
avg_n_ratings = total / len_genre
If it is taking a count of the number of ratings (not actual) and then dividing by total count of the app, I would have thought the total would be one?
Since every time it comes across a rating it increments by 1 and likewise for every time it comes across a genre in the loop; therefore if there were 3 ratings I assume it could only also result in a find of a count of 3 for the genre, and then it would be 3/3 =1. With these results:
Social Networking : 1
Photo & Video : 1
Games : 1
Music : 1
However this is not the case, it is numbers like these:
Social Networking : 71548.34905660378
Photo & Video : 28441.54375
Games : 22788.6696905016
Music : 57326.530303030304
So there is something I seem to be missing.
Please advise?
genres_ios = freq_table(ios_final, -5)
for genre in genres_ios:
total = 0
len_genre = 0
for app in ios_final:
genre_app = app[-5]
if genre_app == genre:
n_ratings = float(app[5])
total += n_ratings
len_genre += 1
avg_n_ratings = total / len_genre
print(genre, ':', avg_n_ratings)