NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Data Visualization > Data Web Scraping Restaurant Logs

Data Web Scraping Restaurant Logs

John Yap
Posted on May 21, 2018
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Preface

This post is about using web scraped online reviews data to (1) create a record log that restaurants can utilize to improve business performance and (2) create a performance evaluation and comparison tool. The latter can be particularly valuable when comparing the performance of different locations of a franchise or chain restaurants of the same brand or how one brand compares to another within the same geographical area or location. The basic ideas are also applicable to regular restaurants or any type of businesses that are subject to online customer reviews. I use web scraped Yelp ratings of Shake Shack and In-N-Out Burger to illustrate my ideas.

Introduction

Online reviews are a mainstay of modern consumerism. In the past, a restaurant that wanted customer feedback to understand what could be improved would have to rely on getting note in its suggestion box.  This was mainly for the benefit of the restaurant. Customers then would rely on articles written by food critics to help them decide where to eat. But times have changed, and we now have a slew of online customer reviews websites, like Yelp and TripAdvisor, that, in some sense, benefits both the customers and the restaurants.

A rating, represented by number of stars (Yelp) or bubbles (TripAdvisor), is the most important part of an online review.   It is the epitome of a customerโ€™s impression about her dining experience. An online review usually also includes some content that tells online readers what is good or bad about the restaurant. Sometimes the review tells readers explicitly whether they should patronize the restaurant or not.

This arrangement creates a special scenario whereby restaurants are โ€œexposedโ€ to the public based on what customers are saying about them. The basic idea behind this scenario is not new. Food critics in the past often had the power to dictate the success or failure of restaurants through media exposure.  But now some of that power is extended to the public.  These days Yelp or TripAdvisor play the role of food critic ambassador, collecting and presenting customer reviews online.

Motivation

It is not surprising then that restaurants nowadays are under additional pressure to work more on their media image to stay competitive or even stay in business. A few weeks prior to this blog post, it was reported that after a customer left a 3-star rating on Yelp, a restaurant manager went as far as going to the customerโ€™s house in the evening to talk about the less-than-favorable review.  While his concern is understandable, there are certain lines that just should not be crossed.

Instead of reaching out to people in intimidating ways, I propose that restaurants, in particular chain restaurants, cope with online customer reviews by using the ratings as an aid to help improve their businesses. I illustrate my proposal using web scraped Yelp reviews on New Yorkโ€™s pride burger chain, Shake Shack, and Californiaโ€™s beloved In-N-Out Burger. I present how you can (1) create a database log of web scraped Yelp reviews and (2) utilize Yelp ratings as a performance evaluation and comparison tool.  You can find more details about web scraping and analyses codes on my GitHub page.

Creating Your Own Database and Systematic Data Analysis of Yelp Ratings

The most important measure in a Yelp review is the average star rating, a value between 1 to 5 stars with 5 being the best rating. The higher the average rating, the higher the odds of your restaurant being selected over others in the area with lower ratings.

Reviews are initially presented on Yelp based on a โ€œYelp sort.โ€ However, it may not be clear to a user exactly how the reviews are sorted. It is not efficient to read all the reviews one at a time unless there are only a few of them.  Instead, you can first sort the reviews by date or rating and then identify the low ratings and read the corresponding reviews, if low ratings are what you are concerned about. But I think there is a better and more systematic way to do this.

The first step is to web scrape Yelp data using Beautiful Soup (or any other free web scraping software). After you have obtained Yelp data from web scraping, then you can sort the reviews yourself, however way you want! You can also visualize these data using whatever software you prefer. I will illustrate using Plotly, which is free, but you can also use Excel or the free open source software, R.

Yelp Ratings on In-N-Out

It is nice and convenient to have a single average Yelp rating for each restaurant but this rating does not really tell everything about a restaurantโ€™s performance. What if the restaurant used to have high ratings but during the last few weeks there were many low ratings? The average rating might still be somewhat high, but the shift in direction could mean that a customerโ€™s visit in the near future might not be favorable compared to a few weeks earlier. The restaurant manager should note and take action! In my opinion, it is best to visualize Yelp rating data over the dates the reviews were posted like so:

Data Web Scraping Restaurant Logs

Observations

The data for this graph comes from Yelp ratings of In-N-Out Burger in Plano, Texas. This type of data visualization allows a restaurant manager to do the following:

  • Visually inspect rating trends over time. With this, you can tell whether you are getting many low ratings lately, or worse, consecutively! In the example graph above, there were a few low ratings around April through July 2017 but after that were all good.
  • Filter ratings that you may be interested in investigating further. Instead of reading all reviews on the Yelp website, you can read only those in your Yelp reviews database at particular times that you consider important. For example, if you are mainly concerned about 1 or 2-star ratings, then you can identify those in the graph and check the review contents at those specific time points in your database.  This approach can help you understand what could have happened on those dates: Did the low ratings correspond to the approximate time when the restaurant was understaffed?
Record Log

With your new Yelp ratings database, you can turn it into a records log of actions that you can take to address the low Yelp ratings.  Concretely, you can create new additional column names in your Yelp database table like โ€œNature of Yelp Review,โ€ โ€œAddressed When,โ€ and โ€œAddressed How.โ€ The โ€œNature of Yelp Reviewโ€ can be any category like logistics (floor not clean, trash on tables), food (salty burger, limp fries, shakes melted), or service (long wait time, rude cashier, incorrect orders).

This way you can note which category (logistics, food, or service) tends to occur more often than the others and identify areas of improvement. Perhaps your restaurant has too many service complaints.  That could indicate you need to invest in additional staff training. By noting in your database when and how the Yelp review complaint was addressed, you can have a record to look back on and avoid repeating the same mistakes in the future. This could be particularly useful when there is a transition in the businessโ€™ management because the new manager would not have to start from scratch. Just turn over the records that you have accumulated from the previous manager.

Yelp ratings as a Performance Evaluation Tool

If you are a manager concerned about Yelp, how would you know whether your restaurant is improving its Yelp rating? Itโ€™s actually quite simple when you have web scraped Yelp data! As we have done earlier, order the ratings by the dates they were posted. For each rating date, take the average of all ratings until that date. The value that we just computed is the same as Yelpโ€™s average rating posted on that date (before the next review is posted).  See details about how this computation can be encoded on my GitHub page.

Using the same Yelp ratings of In-N-Out Burger in Plano, Texas, you can create a graph that looks like this:

Data Web Scraping Restaurant Logs

There are two insights that can be gained from this graph. First, In-N-Out Burgerโ€™s Yelp rating dipped from 5 to 3 stars soon after opening around 2012. Second, in a span of around 1.5 years, the ratings improved to 4 stars and remained somewhat level until today. Great job In-N-Out Burger manager!

Comparing with In-N-Out in the Area

You can also compare your performance with other In-N-Out Burger restaurants in the area:

It looks like all three chains suffered from low ratings in the beginning, with Dallas North taking the biggest hit. But Dallas North improved by one star after three years. The Plano outlet still has the best average Yelp rating over time.

In-N-Out vs Shake Shack

But wait, thereโ€™s more! What about your competitorโ€™s performance? Letโ€™s bring in Shake Shack:

Data Web Scraping Restaurant Logs

Shake Shack came into the Texas scene in late 2016. It appears that Shake Shack did not suffer as badly โ€œYelp-wiseโ€ as In-N-Out in the beginning. Does this mean that Texans like Shake Shack more than In-N-Out or simply that they have already acclimated to out-of-state imported burger chains?  Towards 2018, the average ratings are about the same for all outlets except for In-N-Out in Plano, Texas, which outperformed everyone else. Perhaps the manager at this outlet really deserves a pay raise or a promotion?!

When to Web Scrape Yelp

Once you have your Yelp data in place within your computer system, you will continually need to update your database with new Yelp reviews. How frequently it has to be done depends on how many reviews your restaurant gets. Let us graph the number of reviews per month for In-N-Out Burger in Plano, Texas:

Number of Yelp Reviews

The graph indicates that there are only 1-3 Yelp reviews per month lately. It may be better to update your database every quarter. For outlets with more customer volume and reviews, such as Shake Shack in Madison Square Park, New York, the pattern looks quite different:

Number of Ratings

This location was the first Shake Shack outlet that opened around 2004-2005.  Coincidentally, this is around the time that Yelp started doing business. The graph indicates that lately, there are approximately 5-15 reviews per month, so perhaps database updates can be done once each month. Note, however, that there were times when the number of reviews per month were much higher, reaching over a hundred reviews per month. I am not sure what happened during these years. Were these the peak years of Shake Shackโ€™s popularity? During those years, a database update may be warranted once per week.

Shake Shack at Madison Square Park, New York

Final Thoughts

To some, if not most, restaurant businesses, Yelp or other online customer ratings may appear dreadful. But they can be used as an opportunity to improve your business. You can turn them into your own database or record log to note when and how you addressed unfavorable reviews.  By categorizing customer review complaints, you can note areas where you can make improvements. You can also set a goal of improving your business performance in a โ€œYelp-wiseโ€ fashion using the performance evaluation and comparison tool proposed here. With web scraping and other free tools available nowadays, you can help improve your business with little or no cost, and only minimal effort!

Blog Post Image Source: https://stocksnap.io/

About Author

John Yap

A statistician with several years of experience working on clinical trials and observational studies. John attended NYCDSA to learn about this very exciting data science field. He hopes to use his experience and data science knowledge to help...
View all posts by John Yap >

Related Articles

Capstone
Acquisition Due Dilligence Automation for Smaller Firms
Machine Learning
Beware of Feature Importance for Business Decisions
Meetup
Building a Safer Future
Python
Tech Layoffs: Exploring the Trends and Industry Shifts
Meetup
Analysis of Mass Shootings and Gun Ownership in the United States

Leave a Comment

Cancel reply

You must be logged in to post a comment.

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application