Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.1 Preprocessing of restaurant and review data (15 points) Load and preprocess restaurant and customer review data that is stored in JSON files. The

2.1 Preprocessing of restaurant and review data (15 points) Load and preprocess restaurant and customer

2.1 Preprocessing of restaurant and review data (15 points) Load and preprocess restaurant and customer review data that is stored in JSON files. The files store information regarding the restaurants and customer reviews for a very small subset of the Yelp dataset. Look at the format of the data in the two files to understand its structure or read the dataset documentation here. The Python JSON API is documented here. []: import json business = json.load(open('../data/business.json')) reviews = json.load(open('../data/review.json')) # Create the id2business` table that maps the "business_id" to the corresponding restaurant object. id2business = {} # YOUR CODE HERE (5 points) #Create the location2business` table that maps a tuple (city, state) to au list of restaurants at that location. location2business {} # YOUR CODE HERE (5 points) # For each location show the number of restaurants. For example, the largestu number (8) should be in Philadelphia. for location in location2business: print (location, len(location2business [location])) # The "categories" field of a restaurant lists a number of categories, usually related to food served or cuisine. 2 # For each unique category that is in the data, show the total number ofu restaurants. # For example, there are 5 restaurants that are categorized as Mexican. cat2freq 0} # YOUR CODE HERE (5 points) #Print all category --> count mappings. For example, cat2freq['Merican] should be 5. print (cat2freq)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The image you provided describes a problem in which JSON files containing restaurant and review data need to be preprocessed The tasks are to create t... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing A Practical Approach with Data Analytics

Authors: Raymond N. Johnson, Laura Davis Wiley, Robyn Moroney, Fiona Campbell, Jane Hamilton

1st edition

1119401747, 978-1119401742

More Books

Students also viewed these Programming questions