Question
Python--- We are given a data set of Google Play app store. The data set contains the data about several apps. This data set is
Python---
We are given a data set of Google Play app store. The data set contains the data about several apps. This data set is provided in the data.py file. To use this file for answering questions, you have to import the data variable from this file. The data variable is a NumPy array containing many rows, one for each app, and 13 columns. Columns in order are: 1. App name 2. Category . Rating 4. Number of reviews 5. App size 6. Number of installs 7. App type (Free or Paid) 8. App price 9. Content Rating 10. Genres 11. Last updated date 12. Current version 13. Android version Please answer the following questions by writing a function for each one. Name of the function for each question is given, and each function should exactly accepts one argument, which is the data array provided. Then, each function should return a value in the form of a Python dictionary (dict) with the asked values. Also, keep in mind that every element in the array is of type string and in some cases, you need to perform proper type conversion. a. Write a function called calculate category sizes that calculates number of the apps in each category. The return value of the function should be a dictionary with the category titles as the keys and number of the apps in each category as the value. Please note that there might be missing values and your function should ignore those. For example, the returned dictionary from calling calculate category sizes(data), should contain ART AND DESIGN: 65. b. Write a function called calculate category ratings that calculates the average rating for each category. The return value of the function should be a dictionary with the category titles as the keys and the average rating for each category as the value. Please note that there might be invalid ratings and you need to check for those and ignore them. For example, calling calculate category ratings(data) should return a dictionary containing ART AND DESIGN: 4.36. c. Write a function called calculate type sizes that calculates number of the free and paid apps. The return value of the function should be a dictionary with the Free and Paid as the keys and number of the apps of each type as the value. Please note that there might be missing values and your function should ignore those. For example, the returned dictionary from calling calculate type sizes(data), should contain Free: 10040.
d. Write a function called calculate type ratings that calculates the average rating for each app type (i.e., Free vs Paid). The return value of the function should be a dictionary with the app types as the keys and the average rating for each app type as the value. Please note that there might be invalid ratings and you need to check for those and ignore them. For example, calling calculate type ratings(data) should return a dictionary containing Free: 4.19. e. Write a function called calculate size histogram that generates a histogram of the app sizes. The function should generate 5 bins. Keep in mind that app sizes are in string format and they either end in M denoting megabytes or k denoting kilobytes. For these values, strip the last character and convert the numerical part. Other values should be ignored. Also, make sure to convert kilobytes to megabytes by dividing the value by 1024. The return value from the function should be a dictionary with keys being the ranges for the bin and the value being the count. The range should be in - format. For example, the dictionary returned by calling calculate size histogram(data) should contains 20.01 - 40.00: 1832.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started