In this post we scrape Yelp reviews to get a sense of how restaurant chains are performing over time. Our goal here is to show what can be done with some Python website scraping and Tableau visualizations and will save fancier data analysis for a future post. We are not suggesting one can trade strictly off of Yelp data, but it could be one of many inputs into a trade decision or one of many datasets used to monitor existing investments.

We will look at 2 cases:

  1. Chipotle
  2. Three Texas Taco Chains

Anatomy of a Yelp Review

A Yelp review contains 3 main components:

  1. A date of the review
  2. A 1.0 – 5.0 rating (with 5.0 being the best)
  3. A freeform text section where reviewers can expand on their numerical rating

Technology Tools Used

The scripts to scrape the restaurant reviews were written in Python. The results were then loaded into Google BigQuery and visualizations were created in a Python notebook for the Chipotle case and Tableau Online (which offers the ability to pull data directly from BigQuery) for the Texas taco chains case.

Chipotle

We scraped approximately 150,000 reviews from about 2,500 U.S. Chipotle restaurants. Then we looked at the average number of reviews per day and the average rating of the restaurant chain over the past month. Below is the plot for Chipotle.

Pandas plot for Chipotle’s review counts and review ratings

Since 2010, the number of reviews per day for Chipotle has increased significantly (not surprising since the number of Chipotle locations has also increased). Perhaps what is most interesting is the consistent downward trend of the Yelp ratings for the restaurant chain falling from 3.8 in 2010 down to 2.4 in 2019.

In late 2015, there seems to be a significant spike up in the ratings before continuing the downward trend. In mid-October 2015, Chipotle had its first major food poisoning issue. Below is a chart with Chipotle’s stock price on the left axis and the average Yelp ratings on the right axis.

Pandas plot for Chipotle’s stock price and review ratings

What appears to happen here is Chipotle’s food poisoning issue became public mid-October 2015, causing its stock price to fall about 55%. Then, looking at spike up in Yelp ratings, it appears Chipotle made improvements, causing customers to be more satisfied. However, the effects seem to be temporary as just a few months later, the Yelp ratings continued its downward trend, possibly foreshadowing the continued food safety issues Chipotle encountered in the following years.

Three Texas Taco Chains

Here we look at three small Texas taco chains versus each other: Velvet Taco, Torchy’s Taco, and Mi Cocina.

Below is a Tableau dashboard that we created to visualize the data. It contains 4 plots:

  1. Yelp Review Ratings – The 30 day moving average rating of each restaurant.
  2. Normalized Yelp Review Counts – The 30 day moving average of ratings per location using 1/1/2012 as a baseline (a value of 5 means 5x more ratings per location at that point in time versus 1/1/2012).
  3. Locations Open (Norm) – The multiple the restaurant chain has expanded by using 1/1/2012 as a baseline (a value of 9 means 9x more locations at that point in time versus 1/1/2012).
  4. Locations Open – The raw number of locations open.
Tableau visualization for Mi Cocina, Torchy’s Tacos and Velvet Taco

There are a few interesting things that can be seen from the plots above:

  1. Velvet Taco has expanded the most. Through its expansion, customers seem to be just as satisfied in 2019 as in 2012 (average rating remained the same). They are also pulling in about the same number of customers per location now as in 2012 (as measured by the Normalized Yelp Review Counts), although there is some volatility there.
  2. Torchy’s Tacos has also expanded quite a bit. However, it seems that through their expansion, customers have become less satisfied. In 2012, they had an average customer rating on par with Velvet Taco, but today, Torchy’s Yelp rating is significantly lower than Velvet Taco’s Yelp rating.
  3. Mi Cocina has not opened nearly as many new locations as the other two chains. However, they’ve significantly increased their traffic per location and their Yelp rating has also substantially increased.

While we are not suggesting that the above information is conclusive, as an investor or potential investor in any one of these three restaurant chains, this information could be a valuable piece of the puzzle.

Summary

Here we’ve shown what some simple web scraping can do. There are obviously many improvements that can be made to the above and much more analysis that can be done with the reviews, but we will save that for a future blog post.

Leave a Reply