CS 6752 Homework 3
Due: Thursday, October 6 at 1:30 pm

Assignment 3: Find a good restaurant

In this HW, you will get practice reading in accessing data from the web and/or using a web API, manipulating and analyzing formatted data files, and generating visualizations of the data and your analysis.

In this assignment, you will use Yelp's data about restaurants that they make available over the web. You can access it via one of two ways. First, Yelp publishes an API that you can use to access reviews from their site and data about them. You will need to use the requests library to do this. You should use Version 2 of the API. Specifically, you should use the Search API. You can get data related to ratings, categories, location, number of reviews, etc. (Yelp also has a new Version 3 of the API, but we recommend you don't use it because it is so new, and it doesn't have as much help scattered on the Web.)

You should explore the documentation about the Search API to understand how it works, how authentication must be done, what fields are returned, etc. The documentation provides an example of one restaurant's data that is returned.

An alternative is to use Yelp's Python Library for accessing the data. This is like the Tweepy Python interface fo Twitter. It does not require the use of requests. There's a good tutorial on using the API available too.

When your program runs, it should first connect to the Yelp API. For this assignment, you will examine the restaurants in 5 different cities. Your program should ask the user what cities they want to analyze. The user will enter five string names for the cities, one to a line (do something smart if it's not a valid city.) After that, your program should do the following things for the selected cities:

For extra credit, feel free to add any other analyses that you think are particularly informative. For example:

Notes & Hints:
  • Look over the slides from the last couple weeks to get ideas and tips about how to accomplish the assignment objectives.
  • In order to use the API, you'll need to install and import rauth.
  • Learning and using groupby will be really helpful in this assignment.
  • For converting json to csv, check out json_normalize.
  • Look at the matplotlib.pyplot savefig function for writing out figures of graphs to disk.

    Turn-in Procedures

    After you have finished the above assignment, turn it in via T-Square. Please name your file LastName_yelp.py.