Full report with all code snippets, graphs, and interpretations in plain English

Import all Python Data Science packages for the analysis

import pandas as pd
import numpy as np
from pprint import pprint
import io
import os
from bs4 import BeautifulSoup
import requests,json, re
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
df = pd.read_csv("/Users/owner/Desktop/DS_AI_projects/web_scraping/data.csv")
df = df.drop(columns=["cuisine_type"])
df.head(20)

Screen Shot 2022-04-08 at 1.42.00 AM.png

As we can see, there is a bunch of missing data, so let’s fill that with “None”. I’ve also noticed that some of the values in the “pricing” and “rating” columns is not in the correct int64 format, so I’ll change that.

df["type2"].fillna("None", inplace=**True**)
df["type3"].fillna("None", inplace=**True**)
df["pricing"] = df["pricing"].apply(lambda x: str(len(x)))
df["rating"] = df["rating"].apply(lambda x: float(x.strip("star rating")))

Take a Look at Mean Ratings

np.mean(df['rating'])

Screen Shot 2022-04-08 at 1.49.57 AM.png

The average rating of restaurants across Davis is about 3.87, a fairly high average. It's safe to say that Davis local businesses in general have a positive public perception. But this information is too general. Let’s dive deeper!

vis = df.groupby("rating")["votes"].sum()
vis = pd.DataFrame(vis).reset_index()
vis

Screen Shot 2022-04-08 at 1.54.38 AM.png

Graph the ratings and the votes

**import** **plotly.express** **as** **px**
fig = px.bar(vis, x="rating", y="votes", title="Rating vs Votes")
fig.show()

Screen Shot 2022-04-08 at 2.03.58 AM.png

fig = px.bar(df, x="rating", y="votes", color="pricing", title="Popularity of Davis Restaurants Based on Count and Pricing")
fig.show()

Screen Shot 2022-04-08 at 2.05.28 AM.png

df["rating"].value_counts()