DEV Community

Cover image for you can use this FoodHub Case Study Code
ANNA LAPUSHNER
ANNA LAPUSHNER

Posted on

you can use this FoodHub Case Study Code

This was a really fun project. It was just rad to be given the opportunity to showcase this awesome stuff! This code has color and style, so if you're into getting jazzy on your presentations, be my guest and have at it!

code on and conquer..

https://drive.google.com/file/d/1XnIKpd-aE08_sPUJuphwSL4N7K4EHZnv/view?usp=sharing

https://colab.research.google.com/drive/1m5OBtEKyFDgk6wtbOJ-q9GvErzxyVBeb?usp=drive_link

Import necessary libraries

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
from scipy.stats import binom

%matplotlib inline

Connect to Google Drive to access necessary files

from google.colab import drive
drive.mount('/content/drive')

Define file path to access the data file

file_path = '/content/drive/MyDrive/2024_mit/Projects/Food Hub/foodhub_order.csv'

Read the data file into a pandas DataFrame

Use the standard name "df" to name the DataFrame

df = pd.read_csv(file_path)
Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).

Use .head() to describe the data

df.head()
order_id customer_id restaurant_name cuisine_type cost_of_the_order day_of_the_week rating food_preparation_time delivery_time
0 1477147 337525 Hangawi Korean 30.75 Weekend Not given 25 20
1 1477685 358141 Blue Ribbon Sushi Izakaya Japanese 12.08 Weekend Not given 25 23
2 1477070 66393 Cafe Habana Mexican 12.23 Weekday 5 23 28
3 1477334 106968 Blue Ribbon Fried Chicken American 29.20 Weekend 3 25 15
4 1478249 76942 Dirty Bird to Go American 11.59 Weekday 4 25 24
Question 1: How many rows and columns are present in the data?

Use .shape to describe the data as (rows, columns)

df.shape
(1898, 9)
Question 2: What are the datatypes of the different columns in the dataset?

Use .info() to identify the datatypes in each column

df.info()

RangeIndex: 1898 entries, 0 to 1897
Data columns (total 9 columns):
# Column Non-Null Count Dtype


0 order_id 1898 non-null int64

1 customer_id 1898 non-null int64

2 restaurant_name 1898 non-null object
3 cuisine_type 1898 non-null object
4 cost_of_the_order 1898 non-null float64
5 day_of_the_week 1898 non-null object
6 rating 1898 non-null object
7 food_preparation_time 1898 non-null int64

8 delivery_time 1898 non-null int64

dtypes: float64(1), int64(4), object(4)
memory usage: 133.6+ KB
Question 3: Are there any missing values in the data? If yes, treat them using an appropriate method.

Use .isnull().sum() to determine if there are missing values in the data

df.isnull().sum()
0
order_id 0
customer_id 0
restaurant_name 0
cuisine_type 0
cost_of_the_order 0
day_of_the_week 0
rating 0
food_preparation_time 0
delivery_time 0
dtype: int64
Question 4: Check the statistical summary of the data. What is the minimum, average, and maximum time it takes for food to be prepared once an order is placed?

Use describe().T to get the statistical summary the numerical data

df.describe().T
count mean std min 25% 50% 75% max
order_id 1898.0 1.477496e+06 548.049724 1476547.00 1477021.25 1477495.50 1.477970e+06 1478444.00
customer_id 1898.0 1.711685e+05 113698.139743 1311.00 77787.75 128600.00 2.705250e+05 405334.00
cost_of_the_order 1898.0 1.649885e+01 7.483812 4.47 12.08 14.14 2.229750e+01 35.41
food_preparation_time 1898.0 2.737197e+01 4.632481 20.00 23.00 27.00 3.100000e+01 35.00
delivery_time 1898.0 2.416175e+01 4.972637 15.00 20.00 25.00 2.800000e+01 33.00

Use describe(include = 'all').T to get the statistical summary the numerical data

df.describe(include='all').T
count unique top freq mean std min 25% 50% 75% max
order_id 1898.0 NaN NaN NaN 1477495.5 548.049724 1476547.0 1477021.25 1477495.5 1477969.75 1478444.0
customer_id 1898.0 NaN NaN NaN 171168.478398 113698.139743 1311.0 77787.75 128600.0 270525.0 405334.0
restaurant_name 1898 178 Shake Shack 219 NaN NaN NaN NaN NaN NaN NaN
cuisine_type 1898 14 American 584 NaN NaN NaN NaN NaN NaN NaN
cost_of_the_order 1898.0 NaN NaN NaN 16.498851 7.483812 4.47 12.08 14.14 22.2975 35.41
day_of_the_week 1898 2 Weekend 1351 NaN NaN NaN NaN NaN NaN NaN
rating 1898 4 Not given 736 NaN NaN NaN NaN NaN NaN NaN
food_preparation_time 1898.0 NaN NaN NaN 27.37197 4.632481 20.0 23.0 27.0 31.0 35.0
delivery_time 1898.0 NaN NaN NaN 24.161749 4.972637 15.0 20.0 25.0 28.0 33.0

Calculate the IQR of the 'cost_of_the_order' column

Q1 = df['cost_of_the_order'].quantile(0.25)
Q3 = df['cost_of_the_order'].quantile(0.75)
IQR = Q3 - Q1

print("IQR of the mean cost of order:", IQR)
IQR of the mean cost of order: 10.2175

Use .min() to calculate the minimum time it takes for food to be prepared once an order is placed

df['food_preparation_time'].min()
print('Minimum food preparation time is =', round(df['food_preparation_time'].min(), 2), 'minutes')

Use .mean() to calculate the average time it takes for food to be prepared once an order is placed

df['food_preparation_time'].mean()
print('Average food preparation time is =', round(df['food_preparation_time'].mean(), 2), 'minutes')

Use .max() to calculate the maximum time it takes for food to be prepared once an order is placed

df['food_preparation_time'].max()
print('Maximum food preparation time is =', round(df['food_preparation_time'].max(), 2), 'minutes')
Minimum food preparation time is = 20 minutes
Average food preparation time is = 27.37 minutes
Maximum food preparation time is = 35 minutes

Calculate the IQR of the 'food_preparation_time' column

Q1 = df['food_preparation_time'].quantile(0.25)
Q3 = df['food_preparation_time'].quantile(0.75)
IQR = Q3 - Q1

print("IQR of the food preparation time:", IQR)
IQR of the food preparation time: 8.0

Calculate the IQR of the 'delivery_time' column

Q1 = df['delivery_time'].quantile(0.25)
Q3 = df['delivery_time'].quantile(0.75)
IQR = Q3 - Q1

print("IQR of the mean cost of delivery time:", IQR)
IQR of the mean cost of delivery time: 8.0

What restaurant has the longest food prep time

df.groupby('restaurant_name')['food_preparation_time'].mean().sort_values(ascending=False).head(1)
food_preparation_time
restaurant_name
Cipriani Le Specialita 35.0
dtype: float64

How many orders are from Cipriani Le Specialita

df[df['restaurant_name'] == 'Cipriani Le Specialita'].shape[0]
1

Find the food prep time of American restaurants

df[df['cuisine_type'] == 'American']['food_preparation_time'].mean()
27.440068493150687
Question 5: How many orders are not rated?

Use .value_counts() to get a count of all ratings

df['rating'].value_counts()
count
rating

Not given 736
5 588
4 386
3 188
dtype: int64

prompt: total number of rating value counts as not given

df['rating'].value_counts()['Not given']
print('Total number of rating value counts as not given =', df['rating'].value_counts()['Not given'])
Total number of rating value counts as not given = 736
Question 6: Explore all the variables and provide observations on their distributions. (Generally, histograms, boxplots, countplots, etc. are used for univariate exploration)
Order ID

Use .nunique() to check that a unique order ID is assigned to each order

df['order_id'].nunique()
1898
Customer ID

Use .nunique() to check if there are repeat customers

total_customers = df['customer_id'].nunique()

Calculate the percentage of customers who bought more than once

repeat_customers = df['customer_id'].value_counts()[df['customer_id'].value_counts() > 1].shape[0]

Calculate the percentage of customers who purchased more than once

percentage_repeat = (repeat_customers / total_customers) * 100

print(f"Percentage of customers who purchased more than once: {percentage_repeat:.2f}%")
Percentage of customers who purchased more than once: 34.67%

Calculate the number of customers who bought more than twice

repeat_customers_more_than_twice = df['customer_id'].value_counts()[df['customer_id'].value_counts() > 2].shape[0]

Calculate the percentage of customers who purchased more than twice

percentage_repeat_more_than_twice = (repeat_customers_more_than_twice / total_customers) * 100

print(f"Percentage of customers who purchased more than twice: {percentage_repeat_more_than_twice:.2f}%")
Percentage of customers who purchased more than twice: 12.42%
Restaurant name

Identify number of unique restaurant names

df['restaurant_name'].nunique()
178

Print list of restaurant names as a vertical list

for restaurant in df['restaurant_name'].unique():
print(restaurant)
Hangawi
Blue Ribbon Sushi Izakaya
Cafe Habana
Blue Ribbon Fried Chicken
Dirty Bird to Go
Tamarind TriBeCa
The Meatball Shop
Barbounia
Anjappar Chettinad
Bukhara Grill
Big Wong Restaurant Œ¤¾Ñ¼
Empanada Mama (closed)
Pylos
Lucky's Famous Burgers
Shake Shack
Sushi of Gari
RedFarm Hudson
Blue Ribbon Sushi
Five Guys Burgers and Fries
Tortaria
Cafe Mogador
Otto Enoteca Pizzeria
Vezzo Thin Crust Pizza
Sushi of Gari 46
The Kati Roll Company
Klong
5 Napkin Burger
TAO
Parm
Sushi Samba
Haru Gramercy Park
Chipotle Mexican Grill $1.99 Delivery
RedFarm Broadway
Cafeteria
DuMont Burger
Sarabeth's East
Hill Country Fried Chicken
Bistango
Jack's Wife Freda
Mamoun's Falafel
Prosperity Dumpling
Blue Ribbon Sushi Bar & Grill
Westville Hudson
Blue Ribbon Brooklyn
Nobu Next Door
Osteria Morini
Haandi
Benihana
Han Dynasty
Chote Nawab
Mission Cantina
Xi'an Famous Foods
Rubirosa
Joe's Shanghai Ž
ÀŽü£¾÷´
Bareburger
The Odeon
Pongsri Thai
Yama Japanese Restaurant
Momoya
Balthazar Boulangerie
Caf̩ China
Boqueria
Song Thai Restaurant & Bar
Five Leaves
Pinto Nouveau Thai Bistro
Amy Ruth's
Pepe Giallo
indikitch
Yama 49
Piccolo Angolo
Pepe Rosso To Go
L'Express
Amma
Delicatessen
S'MAC
Vanessa's Dumplings
Bhatti Indian Grill
Taro Sushi
Donburi-ya
Hatsuhana
Samurai Mama
Waverly Diner
Tarallucci e Vino Restaurant
P.J. Clarke's
Lantern Thai Kitchen
ilili Restaurant
The Smile
Vanessa's Dumpling House
Bubby's
Woorijip
Dirty Bird To Go (archived)
Haveli Indian Restaurant
Dos Caminos
da Umberto
Sushi of Gari Tribeca
Burger Joint
Room Service
Sarabeth's Restaurant
Xe May Sandwich Shop
Hibino
Mira Sushi
Melt Shop
J. G. Melon
Hummus Place
Saravanaa Bhavan
Friend of a Farmer
The Loop
Balade
Posto
Terakawa Ramen
Kambi Ramen House
Wo Hop Restaurant
Spice Thai
Dickson's Farmstand Meats
UVA Wine Bar & Restaurant
Serafina Fabulous Pizza
Gaia Italian Cafe
Chola Eclectic Indian Cuisine
Hot Kitchen
Junoon
Ravagh Persian Grill
Rohm Thai
Dig Inn Seasonal Market
Olea
Cho Dang Gol
El Parador Cafe
Socarrat Paella Bar
Don's Bogam BBQ & Wine Bar
Alidoro
Tony's Di Napoli
Cipriani Le Specialita
Sushi Choshi
Kanoyama
V-Nam Cafe
Zero Otto Nove
Dos Caminos Soho
Go! Go! Curry!
La Follia
Izakaya Ten
12 Chairs
Philippe Chow
The MasalaWala
brgr
Carmine's
Asuka Sushi
Aurora
Sarabeth's
Crema Restaurante
Big Daddy's
Moonstruck on Second
Cafe de La Esquina
Olive Garden
67 Burger
Tres Carnes
Schnipper's Quality Kitchen
Nha Trang One
Market Table
Galli Restaurant
Hampton Chutney Co.
Byblos Restaurant
Grand Sichuan International
Le Grainne Cafe
Il Bambino
Kori Restaurant and Bar
Despa̱a
Lamarca Pasta
Lucky Strike
Paul & Jimmy's
Hunan Manor
Coppola's East
Emporio
Wa Jeal
Le Zie 2000 Trattoria
Rye House
Hiroko's Place
Frank Restaurant
Sarabeth's West
'wichcraft
Cuisine type

Identify unique number of cuisine types

df['cuisine_type'].nunique()
14

Print list of cuisine types as a vertical list

for cuisine in df['cuisine_type'].unique():
print(cuisine)
Korean
Japanese
Mexican
American
Indian
Italian
Mediterranean
Chinese
Middle Eastern
Thai
Southern
French
Spanish
Vietnamese

Choose plot dimension

plt.figure(figsize=(15,7))

Set title and name x,y axis

plt.title(('Number of orders distributed by cuisine type'), fontsize=15, color='darkorchid')
plt.xlabel('Cuisine Type', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')

Add tick marks to rotate your labels

plt.xticks(rotation = 45)
plt.yticks(rotation = 270)
sns.countplot(data = df, x = 'cuisine_type', palette='viridis',edgecolor='lightgoldenrodyellow')
:12: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.countplot(data = df, x = 'cuisine_type', palette='viridis',edgecolor='lightgoldenrodyellow')

Count the total orders according to the most popular cuisines

american_count = df[df['cuisine_type'] == 'American']['cuisine_type'].count()
japanese_count = df[df['cuisine_type'] == 'Japanese']['cuisine_type'].count()
italian_count = df[df['cuisine_type'] == 'Italian']['cuisine_type'].count()
chinese_count = df[df['cuisine_type'] == 'Chinese']['cuisine_type'].count()
other_count = df[df['cuisine_type'].isin(['Korean','Japanese','Mexican', 'Indian', 'Mediterranean', 'Middle Eastern', 'Thai', 'Southern', 'French', 'Spanish','Vietnamese'])]['cuisine_type'].count()

print("Number of American cuisine orders:", american_count)
print("Number of Japanese cuisine orders:", japanese_count)
print("Number of Italian cuisine orders:", italian_count)
print("Number of Chinese cuisine orders:", chinese_count)
print("Number of orders from Korean, Japanese, Mexican, Indian, Mediterranean, Middle Eastern, Thai, Southern, French, Spanish,Vietnamese is:", other_count)
Number of American cuisine orders: 584
Number of Japanese cuisine orders: 470
Number of Italian cuisine orders: 298
Number of Chinese cuisine orders: 215
Number of orders from Korean, Japanese, Mexican, Indian, Mediterranean, Middle Eastern, Thai, Southern, French, Spanish,Vietnamese is: 801

Create a variable cuisine_popular that = the top 4 most popular cuisines and add other where other = all cuisines not in the top 4

top_cuisines = ['American', 'Japanese', 'Italian', 'Chinese']

Create a new column 'cuisine_popular'

df['cuisine_popular'] = df['cuisine_type'].apply(lambda x: x if x in top_cuisines else 'Other')
plt.figure(figsize=(15, 7))
sns.countplot(data=df, x='cuisine_popular', palette={'Other': 'lemonchiffon', 'Japanese': 'yellow', 'American': 'khaki', 'Italian': 'gold', 'Chinese': 'palegoldenrod'})
plt.title('Distribution of Cuisine Types (Popular vs Other)', fontsize=15, color='darkorchid')
plt.xlabel('Cuisine Type', fontsize=13, color='blueviolet')
plt.ylabel('Number of Orders', fontsize=13, color='mediumorchid')
:2: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

Text(0, 0.5, 'Number of Orders')

Calculate the probability of a customer ordering 'Other' cuisine

prob_other = df[df['cuisine_popular'] == 'Other']['cuisine_popular'].count() / df.shape[0]
print("Probability of ordering Other cuisine: {:.2f}".format(prob_other))

Calculate the probability of a customer ordering 'Italian' cuisine

prob_italian = df[df['cuisine_type'] == 'Italian']['cuisine_type'].count() / df.shape[0]
print("Probability of ordering Italian cuisine: {:.2f}".format(prob_italian))

Calculate the probability of a customer ordering 'Japanese' cuisine

prob_japanese = df[df['cuisine_type'] == 'Japanese']['cuisine_type'].count() / df.shape[0]
print("Probability of ordering Japanese cuisine: {:.2f}".format(prob_japanese))

Calculate the probability of a customer ordering 'American' cuisine

prob_american = df[df['cuisine_type'] == 'American']['cuisine_type'].count() / df.shape[0]
print("Probability of ordering American cuisine: {:.2f}".format(prob_american))

Calculate the probability of a customer ordering 'Chinese' cuisine

prob_chinese = df[df['cuisine_type'] == 'Chinese']['cuisine_type'].count() / df.shape[0]
print("Probability of ordering Chinese cuisine: {:.2f}".format(prob_chinese))
Probability of ordering Other cuisine: 0.17
Probability of ordering Italian cuisine: 0.16
Probability of ordering Japanese cuisine: 0.25
Probability of ordering American cuisine: 0.31
Probability of ordering Chinese cuisine: 0.11

Identify unique customers that order american and non american cuisine

american_customers = df[df['cuisine_type'] == 'American']['customer_id'].unique()
non_american_customers = df[df['cuisine_type'] != 'American']['customer_id'].unique()

unique_american_customers = set(american_customers)
unique_non_american_customers = set(non_american_customers)

print("Number of unique customers who ordered American cuisine:", len(unique_american_customers))
print("Number of unique customers who ordered non-American cuisine:", len(unique_non_american_customers))
Number of unique customers who ordered American cuisine: 417
Number of unique customers who ordered non-American cuisine: 856

Identify unique customers that ordered American and also ordered non-American cuisine

common_customers = unique_american_customers.intersection(unique_non_american_customers)
print("Number of unique customers who ordered both American and non-American cuisine:", len(common_customers))
Number of unique customers who ordered both American and non-American cuisine: 73

Identify unique customers that ordered American cuisine and also ordered non-American cuisine more than once

american_customer_counts = df[df['cuisine_type'] == 'American']['customer_id'].value_counts()
non_american_customer_counts = df[df['cuisine_type'] != 'American']['customer_id'].value_counts()

Customers who ordered American and non-American more than once

result_customers = set(american_customer_counts[american_customer_counts > 1].index).intersection(non_american_customer_counts[non_american_customer_counts > 1].index)

print("Number of unique customers who ordered both American and non-American cuisine more than once:", len(result_customers))
Number of unique customers who ordered both American and non-American cuisine more than once: 14

Identify unique customers that ordered American and Chinese cuisine

american_customers = df[df['cuisine_type'] == 'American']['customer_id'].unique()
chinese_customers = df[df['cuisine_type'] == 'Chinese']['customer_id'].unique()

unique_american_customers = set(american_customers)
unique_chinese_customers = set(chinese_customers)

print("Number of unique customers who ordered American cuisine:", len(unique_american_customers))
print("Number of unique customers who ordered Chinese cuisine:", len(unique_chinese_customers))

Identify unique customers that ordered American and also ordered Chinese cuisine

common_customers = unique_american_customers.intersection(unique_chinese_customers)
print("Number of unique customers who ordered both American and Chinese cuisine:", len(common_customers))
Number of unique customers who ordered American cuisine: 417
Number of unique customers who ordered Chinese cuisine: 162
Number of unique customers who ordered both American and Chinese cuisine: 13
Cost of the order

Use histogram to plot cost of the order

plt.figure(figsize=(15, 7))
plt.title('Distribution of Cost of the Order', fontsize=15, color='darkorchid')
plt.xlabel('Cost of the Order', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.histplot(data=df,x='cost_of_the_order', color='lightgoldenrodyellow',edgecolor='goldenrod')

Use histogram to plot cost of the order

plt.figure(figsize=(15, 7))
plt.xlabel('Distribution of Cost of the Order', fontsize=13, color='darkorchid')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.boxplot(data=df,x='cost_of_the_order',color='yellow')

Use violin plot to plot cost of the order

plt.figure(figsize=(15, 7))
plt.xlabel('Distribution of Cost of the Order', fontsize=13, color='darkorchid')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.violinplot(data=df,x='cost_of_the_order',color='gold',edgecolor='lightgoldenrodyellow')

Day of the week

Unique values for day of the week

df['day_of_the_week'].unique()
array(['Weekend', 'Weekday'], dtype=object)
plt.figure(figsize=(15, 7))
plt.title('Distribution by Weekday and Weekend Day', fontsize=15, color='darkorchid')
plt.xlabel('Weekend Days are Sa,Su Weekday Days are M, T, W, Th, F', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.countplot(data=df, x='day_of_the_week', color='goldenrod', edgecolor='lightgoldenrodyellow')

Rating

Unique values for rating

array_rating = df['rating'].unique()
print(array_rating)
['Not given' '5' '3' '4']

Calculate the percentage of orders that are not rated

not_rated_percentage = (df['rating'].value_counts()['Not given'] / df.shape[0]) * 100
print("Percentage of orders not rated: {:.2f}%".format(not_rated_percentage))
Percentage of orders not rated: 38.78%

Calculate the percentage of orders that are ordered 5

rated_5_percentage = (df['rating'].value_counts()['5'] / df.shape[0]) * 100
print("Percentage of orders rated 5: {:.2f}%".format(rated_5_percentage))
Percentage of orders rated 5: 30.98%
plt.figure(figsize=(15, 7))
plt.title('Available Ratings', fontsize=15, color='darkorchid')
plt.xlabel('Rating Given by the Customer', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.countplot(data=df, x='rating', color='khaki', edgecolor='lightgoldenrodyellow', palette='Purples')
:5: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.countplot(data=df, x='rating', color='khaki', edgecolor='lightgoldenrodyellow', palette='Purples')

Food Preparation time

Histogram of food preparation time

plt.figure(figsize=(15, 7))
plt.title('Distribution of Food Preparation Time', fontsize=15, color='darkorchid')
plt.xlabel('Time', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.histplot(df['food_preparation_time'], edgecolor='lightgoldenrodyellow', color='Orange')

Boxplot of food preparation time

plt.figure(figsize=(15, 7))
plt.title('Distribution of Food Preparation Time', fontsize=15, color='darkorchid')
plt.xlabel('Time', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.boxplot(data=df, x='food_preparation_time', color='yellow')

Delivery time

Histogram of delivery time

plt.figure(figsize=(15, 7))
plt.title('Distribution of Delivery Time', fontsize=15, color='darkorchid')
plt.xlabel('Time', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
plt.ylim(ymax=320)
sns.histplot(data=df,x='delivery_time', edgecolor='gold', color='lightgoldenrodyellow')

Boxplot of delivery time

plt.figure(figsize=(10,5))
plt.title('Distribution of Delivery Time', fontsize=15, color='darkorchid')
plt.xlabel('Time', fontsize=13, color='blueviolet')
plt.ylabel('Frequency', fontsize=13, color='mediumorchid')
sns.boxplot(data=df, x='delivery_time', color='darkgoldenrod')

Question 7: Which are the top 5 restaurants in terms of the number of orders received?

Get top 5 restaurants with highest number of orders

df['restaurant_name'].value_counts().head(5)
count
restaurant_name
Shake Shack 219
The Meatball Shop 132
Blue Ribbon Sushi 119
Blue Ribbon Fried Chicken 96
Parm 68
dtype: int64
Question 8: Which is the most popular cuisine on weekends?

Get most popular cuisine on weekends

df_weekend = df[df['day_of_the_week'] == 'Weekend']
print('The most popular cuisine on the weekends is', df_weekend['cuisine_type'].value_counts().idxmax())
The most popular cuisine on the weekends is American

Get unique values of cuisine on the weekends

df_weekend['cuisine_type'].unique()
array(['Korean', 'Japanese', 'American', 'Italian', 'Mexican',
'Mediterranean', 'Chinese', 'Indian', 'Thai', 'Southern', 'French',
'Spanish', 'Middle Eastern', 'Vietnamese'], dtype=object)

Get the top 6 cuisine types

df['cuisine_type'].value_counts().head(6)
count
cuisine_type

American 584
Japanese 470
Italian 298
Chinese 215
Mexican 77
Indian 73
dtype: int64

Get the top 6 cuisines

top_6_cuisines = df['cuisine_type'].value_counts().head(6).index.tolist()

Filter the DataFrame for the top 6 cuisines

df_top_cuisines = df[df['cuisine_type'].isin(top_6_cuisines)]

Get the top 4 restaurants

top_4_restaurants = df['restaurant_name'].value_counts().head(4).index.tolist()

Filter the DataFrame for the top 4 restaurants

df_top_restaurants = df[df['restaurant_name'].isin(top_4_restaurants)]

Create subplots

fig, axes = plt.subplots(1, 2, figsize=(16, 6))

Plot for top 6 cuisines

sns.countplot(data=df_top_cuisines, x='cuisine_type', ax=axes[0], palette='viridis')
axes[0].set_title('Top 6 Cuisines by Number of Orders')
axes[0].set_xlabel('Cuisine Type')
axes[0].set_ylabel('Number of Orders')
axes[0].tick_params(axis='x', rotation=45)

Plot for top 4 restaurants

sns.countplot(data=df_top_restaurants, x='restaurant_name', ax=axes[1], palette='magma')
axes[1].set_title('Top 4 Restaurants by Number of Orders')
axes[1].set_xlabel('Restaurant Name')
axes[1].set_ylabel('Number of Orders')
axes[1].tick_params(axis='x', rotation=45)

Adjust layout and display the plot

plt.tight_layout()
:17: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.countplot(data=df_top_cuisines, x='cuisine_type', ax=axes[0], palette='viridis')
:24: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.countplot(data=df_top_restaurants, x='restaurant_name', ax=axes[1], palette='magma')

Get most popular cuisine on weekdays

df_weekday = df[df['day_of_the_week'] == 'Weekday']
df_weekday['cuisine_type'].value_counts().idxmax()
'American'

Get top 3 cuisines on weekends

df_weekend = df[df['day_of_the_week'] == 'Weekend']
df_weekend['cuisine_type'].value_counts().head(3)
count
cuisine_type

American 415
Japanese 335
Italian 207
dtype: int64

Calculate median order price on weekends

df[df['day_of_the_week'] == 'Weekend']['cost_of_the_order'].median()
14.41

Calculate median order price on weekdays

df[df['day_of_the_week'] == 'Weekday']['cost_of_the_order'].median()
14.07

Calculate highest median order by cuisine

df.groupby('cuisine_type')['cost_of_the_order'].median().sort_values(ascending=False)
cost_of_the_order
cuisine_type

French 20.470
Thai 19.350
Spanish 16.520
Middle Eastern 16.300
Indian 16.150
Southern 16.110
Mexican 15.570
Italian 14.480
American 14.120
Chinese 14.120
Japanese 14.070
Mediterranean 13.995
Korean 12.180
Vietnamese 12.130
dtype: float64

Find lowest priced order and identify cuisine type

df.groupby('cuisine_type')['cost_of_the_order'].min().sort_values(ascending=True).head(1)
cost_of_the_order
cuisine_type

Japanese 4.47
dtype: float64

Find the lowest priced order

lowest_price_order = df[df['cost_of_the_order'] == df['cost_of_the_order'].min()]

Get the cuisine type of the lowest priced order

lowest_price_cuisine = lowest_price_order['cuisine_type'].values[0]

print("Lowest priced order details:")
print(lowest_price_order[['order_id', 'customer_id', 'restaurant_name', 'cuisine_type', 'cost_of_the_order']]) # Select relevant columns for display
print("\nCuisine type of the lowest priced order:", lowest_price_cuisine)
Lowest priced order details:
order_id customer_id restaurant_name cuisine_type cost_of_the_order
624 1477349 52327 Nobu Next Door Japanese 4.47

Cuisine type of the lowest priced order: Japanese
Question 9: What percentage of the orders cost more than 20 dollars?

Calculate the number of total orders where the cost is above 20 dollars

df_greater_than_20 = df[df['cost_of_the_order'] > 20]
num_df_greater_than_20 = df_greater_than_20.shape[0]

Print the DataFrame in a readable format

print(df_greater_than_20.to_string())
order_id customer_id restaurant_name cuisine_type cost_of_the_order day_of_the_week rating food_preparation_time delivery_time cuisine_popular Revenue total_time
0 1477147 337525 Hangawi Korean 30.75 Weekend Not given 25 20 Other 7.6875 45
3 1477334 106968 Blue Ribbon Fried Chicken American 29.20 Weekend 3 25 15 American 7.3000 40
5 1477224 147468 Tamarind TriBeCa Indian 25.22 Weekday 3 20 24 Other 6.3050 44
12 1476966 129969 Blue Ribbon Fried Chicken American 24.30 Weekend 5 23 17 American 6.0750 40
17 1477373 139885 Blue Ribbon Sushi Izakaya Japanese 33.03 Weekend Not given 21 22 Japanese 8.2575 43
20 1478296 250494 Five Guys Burgers and Fries American 24.20 Weekend 4 21 24 American 6.0500 45
22 1478287 150599 Shake Shack American 29.10 Weekday 5 21 30 American 7.2750 51
25 1476693 41877 Cafe Mogador Middle Eastern 29.10 Weekday 5 20 29 Other 7.2750 49
26 1476995 371590 The Meatball Shop Italian 21.88 Weekday 5 24 27 Italian 5.4700 51
30 1478289 318874 The Kati Roll Company Indian 31.33 Weekend 5 28 25 Other 7.8325 53
31 1477699 302790 Klong Thai 29.05 Weekend 5 35 24 Other 7.2625 59
34 1478244 181782 Parm Italian 29.10 Weekend 5 30 26 Italian 7.2750 56
37 1476871 118709 The Meatball Shop Italian 24.30 Weekday 4 31 29 Italian 6.0750 60
38 1477999 208020 Haru Gramercy Park Japanese 29.83 Weekday 5 20 32 Japanese 7.4575 52
41 1478143 337525 TAO Japanese 33.22 Weekend Not given 23 19 Japanese 8.3050 42
42 1477267 133637 RedFarm Broadway Chinese 24.25 Weekend 5 22 15 Chinese 6.0625 37
44 1476908 365237 Five Guys Burgers and Fries American 22.75 Weekend 5 30 20 American 5.6875 50
46 1476930 198802 DuMont Burger American 29.05 Weekend 5 22 30 American 7.2625 52
50 1477656 300003 Bistango Italian 21.88 Weekend Not given 21 19 Italian 5.4700 40
51 1477883 91817 Blue Ribbon Fried Chicken American 29.39 Weekend Not given 27 28 American 7.3475 55
52 1477205 112036 TAO Japanese 20.23 Weekend 5 22 20 Japanese 5.0575 42
53 1478107 73895 RedFarm Broadway Chinese 29.10 Weekend Not given 22 23 Chinese 7.2750 45
54 1477760 130507 Jack's Wife Freda Mediterranean 22.75 Weekend 3 35 29 Other 5.6875 64
60 1476896 388918 Blue Ribbon Fried Chicken American 24.25 Weekend Not given 28 21 American 6.0625 49
61 1478327 68551 Blue Ribbon Sushi Bar & Grill Japanese 33.03 Weekend Not given 33 20 Japanese 8.2575 53
62 1476820 152786 Cafe Habana Mexican 31.38 Weekend 4 23 27 Other 7.8450 50
64 1478077 82041 Shake Shack American 33.03 Weekday Not given 22 32 American 8.2575 54
65 1478359 361616 Blue Ribbon Brooklyn American 24.20 Weekday 3 22 32 American 6.0500 54
69 1477475 65009 Blue Ribbon Fried Chicken American 32.93 Weekend 5 24 23 American 8.2325 47
73 1477518 133202 Sushi Samba Japanese 29.05 Weekend 5 31 16 Japanese 7.2625 47
76 1477921 97079 Benihana Japanese 29.29 Weekend 5 20 18 Japanese 7.3225 38
78 1476943 87472 RedFarm Hudson Chinese 22.75 Weekend Not given 31 30 Chinese 5.6875 61
84 1478423 129969 The Meatball Shop Italian 21.20 Weekend Not given 34 16 Italian 5.3000 50
88 1477740 129798 TAO Japanese 25.27 Weekday 4 24 24 Japanese 6.3175 48
92 1478211 154030 RedFarm Hudson Chinese 33.03 Weekend 4 26 22 Chinese 8.2575 48
97 1476689 305522 Shake Shack American 24.20 Weekday 4 29 29 American 6.0500 58
100 1478169 80460 Rubirosa Italian 21.83 Weekend 3 30 27 Italian 5.4575 57
101 1477702 128600 Blue Ribbon Fried Chicken American 31.29 Weekday Not given 22 33 American 7.8225 55
103 1476564 83287 Five Guys Burgers and Fries American 24.30 Weekend 5 30 20 American 6.0750 50
104 1478408 134152 The Meatball Shop Italian 22.26 Weekend Not given 28 25 Italian 5.5650 53
105 1477824 345899 TAO Japanese 20.47 Weekend 4 26 30 Japanese 5.1175 56
108 1477281 309513 Otto Enoteca Pizzeria Italian 22.36 Weekend 5 26 27 Italian 5.5900 53
110 1477364 125123 Shake Shack American 21.83 Weekend Not given 23 22 American 5.4575 45
113 1477296 222879 Parm Italian 29.15 Weekday 5 23 27 Italian 7.2875 50
115 1477942 49793 Yama Japanese Restaurant Japanese 22.36 Weekend 5 30 16 Japanese 5.5900 46
116 1477552 137565 Shake Shack American 31.29 Weekday Not given 26 32 American 7.8225 58
128 1476826 53543 Caf̩ China Chinese 24.30 Weekend Not given 20 23 Chinese 6.0750 43
131 1476978 177250 RedFarm Hudson Chinese 25.27 Weekend Not given 34 28 Chinese 6.3175 62
133 1477110 144997 RedFarm Hudson Chinese 29.05 Weekend 4 22 28 Chinese 7.2625 50
135 1476862 58533 The Meatball Shop Italian 29.20 Weekend Not given 31 24 Italian 7.3000 55
137 1478402 232582 Caf̩ China Chinese 32.93 Weekday 3 26 28 Chinese 8.2325 54
142 1477177 42385 Song Thai Restaurant & Bar Thai 24.20 Weekend 5 21 26 Other 6.0500 47
143 1478174 104555 Sushi of Gari Japanese 29.34 Weekday Not given 32 25 Japanese 7.3350 57
145 1477369 139085 Shake Shack American 24.25 Weekday Not given 32 24 American 6.0625 56
146 1476969 198309 Blue Ribbon Sushi Japanese 29.20 Weekend Not given 22 25 Japanese 7.3000 47
150 1478219 41692 Shake Shack American 22.80 Weekend Not given 30 19 American 5.7000 49
152 1477337 123780 Five Guys Burgers and Fries American 33.03 Weekend Not given 29 25 American 8.2575 54
155 1476817 97079 Benihana Japanese 29.05 Weekend Not given 25 26 Japanese 7.2625 51
156 1476659 52463 RedFarm Broadway Chinese 31.33 Weekend 3 33 23 Chinese 7.8325 56
160 1477185 362068 The Kati Roll Company Indian 33.03 Weekend Not given 35 21 Other 8.2575 56
162 1477239 94524 The Meatball Shop Italian 22.36 Weekend 4 28 18 Italian 5.5900 46
174 1476805 93133 Parm Italian 22.80 Weekday 5 33 33 Italian 5.7000 66
175 1478093 268958 Barbounia Mediterranean 20.18 Weekend 5 29 19 Other 5.0450 48
182 1476875 373353 indikitch Indian 22.26 Weekend Not given 35 16 Other 5.5650 51
185 1477774 354719 The Meatball Shop Italian 29.15 Weekend 5 34 20 Italian 7.2875 54
187 1478334 352247 Chipotle Mexican Grill $1.99 Delivery Mexican 25.22 Weekend 4 27 22 Other 6.3050 49
190 1477401 326426 Sushi of Gari Japanese 29.15 Weekend Not given 34 24 Japanese 7.2875 58
194 1477519 140477 Momoya Japanese 31.43 Weekend Not given 24 17 Japanese 7.8575 41
195 1477004 250494 Five Guys Burgers and Fries American 33.03 Weekend 5 29 15 American 8.2575 44
200 1476657 91192 Hill Country Fried Chicken Southern 29.35 Weekend 4 26 24 Other 7.3375 50
211 1476860 336162 Nobu Next Door Japanese 29.15 Weekday 5 28 25 Japanese 7.2875 53
218 1478173 91005 Han Dynasty Chinese 24.25 Weekend 5 33 26 Chinese 6.0625 59
221 1476696 231061 Han Dynasty Chinese 33.03 Weekday Not given 33 31 Chinese 8.2575 64
226 1478290 263199 Sushi of Gari 46 Japanese 31.43 Weekend 4 35 23 Japanese 7.8575 58
238 1477333 111356 Bhatti Indian Grill Indian 29.25 Weekend 5 21 15 Other 7.3125 36
243 1478246 260680 Delicatessen American 32.98 Weekend 5 34 16 American 8.2450 50
244 1476931 124838 Hill Country Fried Chicken Southern 29.15 Weekend 5 33 25 Other 7.2875 58
249 1477810 94483 Bistango Italian 24.20 Weekend Not given 28 21 Italian 6.0500 49
256 1478210 320493 Vanessa's Dumplings Chinese 29.20 Weekday Not given 27 30 Chinese 7.3000 57
260 1476819 104548 Tarallucci e Vino Restaurant Italian 29.10 Weekday Not given 28 33 Italian 7.2750 61
265 1476579 85633 The Meatball Shop Italian 24.20 Weekend 5 24 24 Italian 6.0500 48
268 1476685 96877 The Meatball Shop Italian 22.26 Weekday 4 30 26 Italian 5.5650 56
270 1476892 177078 Lantern Thai Kitchen Thai 21.93 Weekday Not given 22 25 Other 5.4825 47
274 1477057 390490 Blue Ribbon Brooklyn American 22.85 Weekend 3 23 19 American 5.7125 42
282 1476846 82041 Parm Italian 22.80 Weekend Not given 35 20 Italian 5.7000 55
289 1477525 52360 TAO Japanese 24.30 Weekend Not given 24 22 Japanese 6.0750 46
290 1477920 83504 Balthazar Boulangerie French 29.15 Weekday 4 31 28 Other 7.2875 59
292 1477640 105992 RedFarm Broadway Chinese 24.30 Weekend 5 27 29 Chinese 6.0750 56
295 1478324 250494 Blue Ribbon Fried Chicken American 29.10 Weekend 4 21 22 American 7.2750 43
297 1477573 58898 RedFarm Broadway Chinese 21.39 Weekend 5 23 24 Chinese 5.3475 47
298 1476728 250494 Bubby's American 24.25 Weekend Not given 34 28 American 6.0625 62
299 1477815 144997 RedFarm Hudson Chinese 32.93 Weekend Not given 33 30 Chinese 8.2325 63
308 1477032 60052 Rubirosa Italian 29.10 Weekend 5 30 28 Italian 7.2750 58
314 1478229 64153 Blue Ribbon Fried Chicken American 21.34 Weekend Not given 35 23 American 5.3350 58
322 1477834 22405 The Meatball Shop Italian 20.18 Weekend 4 32 26 Italian 5.0450 58
328 1478075 232359 The Meatball Shop American 29.25 Weekend 3 21 19 American 7.3125 40
335 1476702 152786 Cafe Habana Mexican 25.22 Weekday Not given 32 28 Other 6.3050 60
337 1477598 81110 Hill Country Fried Chicken Southern 24.20 Weekend 4 25 15 Other 6.0500 40
341 1477326 52031 Han Dynasty Chinese 21.93 Weekend Not given 24 20 Chinese 5.4825 44
343 1478396 74925 Cafe Mogador Middle Eastern 24.20 Weekend 4 32 22 Other 6.0500 54
349 1477375 235620 Shake Shack American 32.93 Weekend Not given 32 25 American 8.2325 57
353 1476999 63417 Pepe Rosso To Go Italian 24.20 Weekend 3 27 19 Italian 6.0500 46
355 1477040 301618 Vanessa's Dumplings Chinese 25.22 Weekday Not given 32 24 Chinese 6.3050 56
356 1476599 47386 Bubby's American 22.75 Weekend 5 32 16 American 5.6875 48
358 1477099 391746 Blue Ribbon Sushi Japanese 24.30 Weekend 4 35 18 Japanese 6.0750 53
369 1476732 212469 Blue Ribbon Fried Chicken American 33.03 Weekend 5 34 24 American 8.2575 58
370 1477987 104563 Blue Ribbon Sushi Japanese 24.25 Weekend 4 24 23 Japanese 6.0625 47
376 1477026 355592 Caf̩ China Chinese 21.83 Weekend 4 32 15 Chinese 5.4575 47
377 1476897 197265 Hill Country Fried Chicken Southern 29.15 Weekend Not given 20 17 Other 7.2875 37
378 1476560 149508 Shake Shack American 22.26 Weekend 4 32 17 American 5.5650 49
380 1477958 309981 Blue Ribbon Fried Chicken American 29.10 Weekend Not given 31 27 American 7.2750 58
383 1478252 94167 Dos Caminos Mexican 22.36 Weekend Not given 30 26 Other 5.5900 56
386 1476623 277898 Blue Ribbon Fried Chicken American 24.30 Weekend 5 22 26 American 6.0750 48
388 1478104 75722 Osteria Morini Italian 24.25 Weekday Not given 22 24 Italian 6.0625 46
389 1478065 212326 RedFarm Broadway Chinese 20.18 Weekday Not given 30 26 Chinese 5.0450 56
397 1477919 75484 Five Guys Burgers and Fries American 29.15 Weekend Not given 20 16 American 7.2875 36
405 1477690 370096 Melt Shop American 21.93 Weekend 5 30 18 American 5.4825 48
408 1478108 87188 Momoya Japanese 32.93 Weekday 3 28 27 Japanese 8.2325 55
411 1477517 77793 The Meatball Shop Italian 29.15 Weekend 5 23 30 Italian 7.2875 53
415 1476664 164016 Blue Ribbon Fried Chicken American 24.30 Weekday 5 20 27 American 6.0750 47
417 1477482 114919 Yama Japanese Restaurant Japanese 25.27 Weekend Not given 30 16 Japanese 6.3175 46
419 1477094 384571 Blue Ribbon Fried Chicken American 22.31 Weekday 5 28 27 American 5.5775 55
430 1477663 93133 Nobu Next Door Japanese 29.29 Weekday 4 30 24 Japanese 7.3225 54
431 1477195 64830 Cafeteria American 20.47 Weekday 3 32 24 American 5.1175 56
433 1477058 65779 The Kati Roll Company Indian 24.35 Weekday Not given 33 29 Other 6.0875 62
439 1478355 68103 The Meatball Shop Italian 21.83 Weekend 4 30 20 Italian 5.4575 50
442 1476806 203370 Chipotle Mexican Grill $1.99 Delivery Mexican 24.30 Weekday Not given 21 33 Other 6.0750 54
443 1478000 167136 ilili Restaurant Middle Eastern 29.05 Weekend Not given 24 29 Other 7.2625 53
447 1477558 268365 Cafe Mogador Middle Eastern 25.17 Weekend 4 23 30 Other 6.2925 53
448 1477458 114247 Shake Shack American 20.23 Weekend Not given 32 18 American 5.0575 50
451 1477319 145389 Westville Hudson American 20.23 Weekday Not given 31 29 American 5.0575 60
452 1477731 122609 Blue Ribbon Sushi Izakaya Japanese 24.25 Weekend 5 33 21 Japanese 6.0625 54
456 1478046 53289 The Loop Japanese 31.38 Weekend 4 26 24 Japanese 7.8450 50
457 1478398 137617 Blue Ribbon Fried Chicken American 24.30 Weekend 5 34 21 American 6.0750 55
461 1478247 104555 Sushi of Gari Japanese 32.98 Weekend 4 34 21 Japanese 8.2450 55
469 1477372 55227 Sushi of Gari Tribeca Japanese 29.20 Weekend 5 32 22 Japanese 7.3000 54
474 1477472 67845 RedFarm Hudson Chinese 29.34 Weekend 5 27 29 Chinese 7.3350 56
475 1476738 233614 Yama 49 Japanese 22.36 Weekend Not given 33 25 Japanese 5.5900 58
484 1478209 63141 Shake Shack American 29.10 Weekend Not given 23 28 American 7.2750 51
486 1477809 148499 Posto Italian 24.25 Weekend Not given 23 25 Italian 6.0625 48
488 1477516 52256 Han Dynasty Chinese 29.15 Weekend Not given 31 19 Chinese 7.2875 50
497 1477220 41249 Kambi Ramen House Japanese 32.93 Weekend 5 35 19 Japanese 8.2325 54
502 1476740 60873 Jack's Wife Freda Mediterranean 25.17 Weekday 4 31 25 Other 6.2925 56
504 1478052 77544 Shake Shack American 24.30 Weekend 4 35 16 American 6.0750 51
506 1477856 143984 The Smile American 25.17 Weekend 3 31 15 American 6.2925 46
507 1477592 87357 Shake Shack American 31.43 Weekend 5 30 19 American 7.8575 49
509 1477661 122852 Blue Ribbon Fried Chicken American 24.20 Weekend Not given 28 29 American 6.0500 57
515 1477109 208020 Sushi of Gari 46 Japanese 29.05 Weekend Not given 21 23 Japanese 7.2625 44
516 1476902 165110 Room Service Thai 22.31 Weekend Not given 22 15 Other 5.5775 37
518 1476703 405334 TAO Japanese 25.22 Weekend Not given 26 16 Japanese 6.3050 42
519 1477785 77306 Xi'an Famous Foods Chinese 24.30 Weekend 4 32 29 Chinese 6.0750 61
521 1476643 88185 Momoya Japanese 22.85 Weekend 4 32 17 Japanese 5.7125 49
522 1477371 369452 UVA Wine Bar & Restaurant Italian 29.15 Weekend Not given 29 30 Italian 7.2875 59
524 1476934 126134 Jack's Wife Freda Mediterranean 32.93 Weekend 3 21 16 Other 8.2325 37
529 1478112 232542 The Meatball Shop Italian 22.36 Weekend 4 35 21 Italian 5.5900 56
531 1477400 68775 Sushi of Gari Tribeca Japanese 29.15 Weekend 4 22 17 Japanese 7.2875 39
532 1478274 374826 Waverly Diner American 22.80 Weekend 4 25 21 American 5.7000 46
535 1476904 60845 Blue Ribbon Sushi Japanese 25.27 Weekend 3 20 20 Japanese 6.3175 40
536 1477336 94480 The Meatball Shop Italian 32.93 Weekend 5 34 29 Italian 8.2325 63
537 1476929 61181 S'MAC American 24.20 Weekend Not given 28 17 American 6.0500 45
538 1477812 93505 Rubirosa Italian 24.20 Weekend 5 31 15 Italian 6.0500 46
546 1476572 356195 Blue Ribbon Fried Chicken American 29.15 Weekday 5 20 29 American 7.2875 49
548 1478236 121905 Chipotle Mexican Grill $1.99 Delivery Mexican 22.26 Weekend 4 21 21 Other 5.5650 42
552 1478349 229946 Balthazar Boulangerie French 21.39 Weekend Not given 35 29 Other 5.3475 64
553 1477850 216438 Blue Ribbon Sushi Japanese 29.25 Weekend Not given 33 17 Japanese 7.3125 50
563 1476898 174437 Han Dynasty Chinese 29.20 Weekend Not given 26 30 Chinese 7.3000 56
565 1478335 84502 Nobu Next Door Japanese 25.17 Weekend 4 31 29 Japanese 6.2925 60
573 1477814 62359 Pylos Mediterranean 35.41 Weekday 4 21 29 Other 8.8525 50
579 1477178 47440 Bareburger American 24.20 Weekend 4 23 23 American 6.0500 46
591 1476964 81405 RedFarm Broadway Chinese 24.25 Weekend 5 29 22 Chinese 6.0625 51
593 1476717 151191 Pongsri Thai Thai 20.18 Weekday Not given 23 25 Other 5.0450 48
594 1477851 66373 Blue Ribbon Sushi Izakaya Japanese 32.93 Weekend 4 21 19 Japanese 8.2325 40
599 1478073 121686 TAO Japanese 24.25 Weekend 4 22 21 Japanese 6.0625 43
605 1478409 151333 Melt Shop American 25.27 Weekend 5 27 30 American 6.3175 57
606 1477471 103147 Hot Kitchen Chinese 29.54 Weekend 5 34 28 Chinese 7.3850 62
616 1477098 304509 RedFarm Broadway Chinese 22.80 Weekday Not given 33 33 Chinese 5.7000 66
617 1477399 378482 Shake Shack American 29.49 Weekend Not given 34 24 American 7.3725 58
619 1478288 58231 Rohm Thai Thai 29.10 Weekend Not given 31 23 Other 7.2750 54
622 1477777 73175 Hill Country Fried Chicken Southern 31.43 Weekday 5 25 28 Other 7.8575 53
626 1476774 114400 Shake Shack American 29.39 Weekday Not given 23 33 American 7.3475 56
628 1476775 66636 Shake Shack American 29.10 Weekday 5 29 31 American 7.2750 60
641 1477309 64151 Rubirosa Italian 22.80 Weekday 5 32 27 Italian 5.7000 59
649 1477211 304365 Sarabeth's Restaurant American 21.93 Weekend Not given 25 27 American 5.4825 52
652 1476678 91817 Shake Shack American 21.39 Weekend 4 28 18 American 5.3475 46
653 1478363 138024 Cho Dang Gol Korean 29.25 Weekend 4 23 21 Other 7.3125 44
657 1476977 41246 Shake Shack American 25.17 Weekend 5 27 26 American 6.2925 53
666 1476613 65561 Chipotle Mexican Grill $1.99 Delivery Mexican 29.10 Weekend 5 24 28 Other 7.2750 52
667 1476739 290266 Socarrat Paella Bar Spanish 25.22 Weekend 5 23 20 Other 6.3050 43
668 1476617 53513 The Meatball Shop Italian 31.33 Weekend 3 30 15 Italian 7.8325 45
676 1477852 74412 da Umberto Italian 32.98 Weekend Not given 30 28 Italian 8.2450 58
688 1477922 304587 Westville Hudson American 33.03 Weekend 5 25 18 American 8.2575 43
690 1477219 389155 The Meatball Shop Italian 32.98 Weekday 3 23 25 Italian 8.2450 48
692 1477998 90113 Blue Ribbon Sushi Japanese 29.10 Weekend 5 20 16 Japanese 7.2750 36
696 1477890 284835 Shake Shack American 22.36 Weekday 3 20 32 American 5.5900 52
698 1478430 133701 The Loop Japanese 24.30 Weekend 5 21 29 Japanese 6.0750 50
703 1478202 345429 Burger Joint American 21.88 Weekend 5 26 24 American 5.4700 50
705 1476933 375704 Shake Shack American 32.98 Weekend 3 22 21 American 8.2450 43
706 1476656 124596 RedFarm Hudson Chinese 29.10 Weekday Not given 27 26 Chinese 7.2750 53
712 1477597 49010 Shake Shack American 24.25 Weekend 5 34 24 American 6.0625 58
713 1478001 64153 Blue Ribbon Fried Chicken American 31.38 Weekend 3 35 20 American 7.8450 55
715 1477846 52574 Blue Ribbon Sushi Japanese 24.25 Weekday 5 30 26 Japanese 6.0625 56
716 1477297 164131 Tony's Di Napoli Italian 29.10 Weekend Not given 26 19 Italian 7.2750 45
721 1477266 85422 Saravanaa Bhavan Indian 24.25 Weekday 5 29 26 Other 6.0625 55
724 1478400 353331 Chipotle Mexican Grill $1.99 Delivery Mexican 29.05 Weekend Not given 28 27 Other 7.2625 55
725 1478403 294478 RedFarm Broadway Chinese 32.98 Weekend 4 25 15 Chinese 8.2450 40
727 1476928 58205 The Meatball Shop Italian 24.30 Weekend Not given 33 21 Italian 6.0750 54
731 1477701 328551 Kanoyama Japanese 32.98 Weekend 5 35 16 Japanese 8.2450 51
733 1477438 94132 Parm Italian 31.33 Weekend Not given 24 16 Italian 7.8325 40
736 1477754 133222 P.J. Clarke's American 21.34 Weekday 5 25 28 American 5.3350 53
746 1477189 54630 V-Nam Cafe Vietnamese 22.26 Weekend 5 33 26 Other 5.5650 59
755 1478441 228541 RedFarm Hudson Chinese 29.10 Weekend Not given 27 28 Chinese 7.2750 55
756 1478399 264399 Han Dynasty Chinese 29.15 Weekday Not given 20 24 Chinese 7.2875 44
757 1477635 124393 Amma Indian 31.43 Weekday 5 20 27 Other 7.8575 47
762 1478141 150865 Vanessa's Dumpling House Chinese 29.10 Weekday Not given 22 25 Chinese 7.2750 47
764 1477959 175290 Otto Enoteca Pizzeria Italian 29.05 Weekend 5 24 18 Italian 7.2625 42
767 1477811 373152 Blue Ribbon Sushi Japanese 24.30 Weekend 5 32 28 Japanese 6.0750 60
769 1477002 133202 ilili Restaurant Middle Eastern 29.25 Weekend 3 27 21 Other 7.3125 48
771 1478150 97806 Shake Shack American 25.22 Weekend 4 35 27 American 6.3050 62
774 1477073 87752 Shake Shack American 29.05 Weekend 5 21 22 American 7.2625 43
777 1477892 196320 Parm Italian 25.17 Weekday 4 33 32 Italian 6.2925 65
778 1477481 47440 Bareburger American 25.22 Weekday 3 31 27 American 6.3050 58
781 1477557 140501 The Meatball Shop Italian 22.36 Weekend 5 32 21 Italian 5.5900 53
784 1477612 56722 Shake Shack American 22.31 Weekday Not given 33 32 American 5.5775 65
795 1478214 103049 TAO Japanese 25.22 Weekend 5 28 17 Japanese 6.3050 45
798 1477841 18902 Rubirosa Italian 21.88 Weekend 4 28 27 Italian 5.4700 55
801 1477173 68300 Blue Ribbon Fried Chicken American 21.83 Weekend Not given 20 27 American 5.4575 47
803 1477496 132137 Parm Italian 22.36 Weekend Not given 27 27 Italian 5.5900 54
808 1478318 263426 TAO Japanese 22.12 Weekday 5 32 30 Japanese 5.5300 62
809 1476734 148327 Shake Shack American 33.03 Weekday Not given 31 28 American 8.2575 59
811 1478180 270525 The Smile American 22.26 Weekend 5 25 26 American 5.5650 51
820 1478208 371590 The Meatball Shop Italian 29.15 Weekend 5 29 27 Italian 7.2875 56
821 1477215 27609 Blue Ribbon Sushi Bar & Grill Japanese 24.25 Weekend 5 25 26 Japanese 6.0625 51
825 1478275 334758 Five Guys Burgers and Fries American 24.30 Weekend 5 28 18 American 6.0750 46
827 1477039 338923 Hill Country Fried Chicken Southern 22.31 Weekday 3 21 25 Other 5.5775 46
833 1478042 201542 TAO Japanese 29.05 Weekend 4 35 24 Japanese 7.2625 59
838 1478435 350180 RedFarm Hudson Chinese 20.32 Weekday 5 30 29 Chinese 5.0800 59
843 1477706 68258 Jack's Wife Freda Mediterranean 22.31 Weekend Not given 23 28 Other 5.5775 51
844 1476971 250494 Parm Italian 28.57 Weekday 5 22 32 Italian 7.1425 54
845 1477470 350659 Shake Shack American 24.25 Weekend 4 27 30 American 6.0625 57
847 1478084 110461 Blue Ribbon Sushi Japanese 22.07 Weekend 4 33 15 Japanese 5.5175 48
848 1478163 372722 Shake Shack American 21.29 Weekend Not given 35 21 American 5.3225 56
850 1477559 127149 P.J. Clarke's American 25.27 Weekday 5 34 29 American 6.3175 63
854 1476863 40010 The Meatball Shop American 31.43 Weekend Not given 31 22 American 7.8575 53
855 1477041 52832 Junoon Indian 25.17 Weekday Not given 23 24 Other 6.2925 47
857 1476616 348096 Parm Italian 31.43 Weekday 5 28 25 Italian 7.8575 53
858 1476968 99621 Jack's Wife Freda Mediterranean 29.05 Weekend 5 35 28 Other 7.2625 63
859 1478045 97420 Yama 49 Japanese 31.33 Weekend 5 21 27 Japanese 7.8325 48
860 1477660 304365 Sarabeth's Restaurant American 24.25 Weekend 5 23 24 American 6.0625 47
862 1477619 75251 Blue Ribbon Fried Chicken American 24.25 Weekend Not given 27 21 American 6.0625 48
863 1477033 59105 Sushi of Gari 46 Japanese 29.05 Weekend 3 35 26 Japanese 7.2625 61
874 1477357 5444 Go! Go! Curry! Japanese 20.18 Weekend 3 22 29 Japanese 5.0450 51
875 1476576 297130 Blue Ribbon Sushi Japanese 31.43 Weekend 5 24 17 Japanese 7.8575 41
881 1477116 126730 The Kati Roll Company Indian 24.20 Weekend 5 26 16 Other 6.0500 42
885 1478286 102580 Blue Ribbon Sushi Izakaya Japanese 29.05 Weekday 4 28 25 Japanese 7.2625 53
887 1478443 96943 Cafe Mogador Middle Eastern 29.88 Weekend 4 20 17 Other 7.4700 37
888 1478195 115519 Blue Ribbon Fried Chicken American 20.23 Weekday 4 20 26 American 5.0575 46
891 1477140 366954 Blue Ribbon Sushi Japanese 24.25 Weekend 5 35 16 Japanese 6.0625 51
897 1477374 177078 Lantern Thai Kitchen Thai 32.93 Weekend Not given 34 27 Other 8.2325 61
898 1477882 80737 RedFarm Broadway Chinese 24.20 Weekday Not given 22 33 Chinese 6.0500 55
900 1477115 87752 Shake Shack American 24.25 Weekday 5 20 27 American 6.0625 47
901 1476658 127149 P.J. Clarke's American 31.43 Weekend 4 31 23 American 7.8575 54
905 1478401 112272 The Kati Roll Company Indian 29.25 Weekend Not given 30 21 Other 7.3125 51
909 1477183 127934 Blue Ribbon Fried Chicken American 33.03 Weekend 5 35 25 American 8.2575 60
912 1477190 397588 Kanoyama Japanese 25.27 Weekday Not given 29 33 Japanese 6.3175 62
914 1477136 120490 Parm Italian 21.88 Weekend 4 23 30 Italian 5.4700 53
915 1476972 111356 Bhatti Indian Grill Indian 32.98 Weekday Not given 32 30 Other 8.2450 62
919 1476622 399332 Philippe Chow Chinese 24.20 Weekday 5 28 30 Chinese 6.0500 58
922 1477696 54809 RedFarm Broadway Chinese 24.30 Weekday 5 24 31 Chinese 6.0750 55
925 1477960 375098 12 Chairs Middle Eastern 29.10 Weekend Not given 22 26 Other 7.2750 48
933 1476967 129798 TAO Japanese 29.49 Weekday Not given 22 32 Japanese 7.3725 54
936 1477416 123977 Vezzo Thin Crust Pizza Italian 22.26 Weekday Not given 22 32 Italian 5.5650 54
940 1477668 160957 Han Dynasty Chinese 22.31 Weekend 5 29 15 Chinese 5.5775 44
943 1477662 6987 Hill Country Fried Chicken Southern 29.78 Weekday Not given 35 33 Other 7.4450 68
947 1477847 106478 Blue Ribbon Sushi Japanese 24.25 Weekday 4 22 29 Japanese 6.0625 51
949 1478429 355090 Shake Shack American 22.85 Weekend 5 24 23 American 5.7125 47
950 1476885 133349 Vanessa's Dumplings Chinese 20.23 Weekend 5 33 17 Chinese 5.0575 50
962 1478371 258275 Cafe Habana Mexican 25.17 Weekend Not given 27 26 Other 6.2925 53
963 1476730 344577 Chipotle Mexican Grill $1.99 Delivery Mexican 29.05 Weekend 4 22 21 Other 7.2625 43
966 1478242 372276 Pinto Nouveau Thai Bistro Thai 24.20 Weekend 5 29 15 Other 6.0500 44
970 1476864 381020 RedFarm Broadway Chinese 31.86 Weekend 4 25 19 Chinese 7.9650 44
989 1477545 144352 Shake Shack American 21.93 Weekday Not given 21 33 American 5.4825 54
990 1478215 92726 Sarabeth's East American 25.27 Weekend 4 23 19 American 6.3175 42
991 1478301 184325 Asuka Sushi Japanese 22.75 Weekday 5 25 32 Japanese 5.6875 57
995 1477005 87006 Nobu Next Door Japanese 25.17 Weekend Not given 21 16 Japanese 6.2925 37
996 1476600 141912 P.J. Clarke's American 24.25 Weekend Not given 24 15 American 6.0625 39
998 1477299 60039 ilili Restaurant Middle Eastern 31.33 Weekday 4 29 27 Other 7.8325 56
1000 1477221 125510 Blue Ribbon Sushi Izakaya Japanese 33.03 Weekend 3 34 23 Japanese 8.2575 57
1001 1476691 68775 Sushi of Gari Tribeca Japanese 24.20 Weekend Not given 22 21 Japanese 6.0500 43
1003 1477913 92096 Aurora Italian 21.93 Weekend Not given 31 18 Italian 5.4825 49
1007 1478404 97991 Blue Ribbon Sushi Bar & Grill Japanese 33.03 Weekend 5 28 15 Japanese 8.2575 43
1009 1476903 53874 Sarabeth's American 25.17 Weekend 3 28 23 American 6.2925 51
1017 1477332 43018 RedFarm Hudson Chinese 24.20 Weekend 5 27 19 Chinese 6.0500 46
1019 1478410 84087 The Meatball Shop Italian 25.22 Weekend 5 32 25 Italian 6.3050 57
1022 1476761 64153 Blue Ribbon Fried Chicken American 24.25 Weekday 5 33 30 American 6.0625 63
1026 1477072 113507 Parm Italian 29.39 Weekday Not given 26 30 Italian 7.3475 56
1029 1477142 87151 Rubirosa Italian 24.20 Weekend 4 23 26 Italian 6.0500 49
1035 1477502 367076 Sushi of Gari 46 Japanese 22.80 Weekend Not given 30 25 Japanese 5.7000 55
1036 1477734 81658 The Meatball Shop Italian 29.25 Weekday 5 35 29 Italian 7.3125 64
1037 1477151 97991 Blue Ribbon Sushi Bar & Grill Japanese 22.36 Weekend 4 25 18 Japanese 5.5900 43
1038 1478333 93437 Sushi of Gari 46 Japanese 22.26 Weekend 5 27 26 Japanese 5.5650 53
1041 1477779 39275 TAO Japanese 31.43 Weekend Not given 34 20 Japanese 7.8575 54
1048 1477368 132137 Parm Italian 24.25 Weekend 4 34 21 Italian 6.0625 55
1052 1477579 349854 Shake Shack American 24.35 Weekday 5 34 26 American 6.0875 60
1056 1477108 47280 Blue Ribbon Sushi Japanese 29.68 Weekend 3 26 30 Japanese 7.4200 56
1060 1478392 77511 Parm Italian 21.93 Weekend 4 22 25 Italian 5.4825 47
1065 1477035 141496 Dickson's Farmstand Meats American 33.03 Weekend 5 35 20 American 8.2575 55
1066 1477923 75115 RedFarm Hudson Chinese 33.03 Weekend 3 32 19 Chinese 8.2575 51
1068 1477590 145952 Blue Ribbon Sushi Japanese 29.15 Weekday Not given 26 24 Japanese 7.2875 50
1073 1477191 93797 ilili Restaurant Middle Eastern 25.22 Weekday 5 25 33 Other 6.3050 58
1078 1478078 54608 Tamarind TriBeCa Indian 22.26 Weekend 5 34 15 Other 5.5650 49
1079 1477443 105903 Shake Shack American 24.30 Weekday 4 35 29 American 6.0750 64
1090 1477727 333311 Blue Ribbon Sushi Izakaya Japanese 21.93 Weekend Not given 35 26 Japanese 5.4825 61
1092 1477948 141550 Serafina Fabulous Pizza Italian 22.80 Weekday 4 28 31 Italian 5.7000 59
1096 1478140 62730 Westville Hudson American 29.10 Weekend Not given 20 24 American 7.2750 44
1105 1478245 52832 Junoon Indian 29.49 Weekend 5 23 17 Other 7.3725 40
1107 1477591 97806 Shake Shack American 31.43 Weekend Not given 30 19 American 7.8575 49
1113 1477928 70709 RedFarm Hudson Chinese 25.17 Weekend Not given 21 17 Chinese 6.2925 38
1117 1477698 60835 Parm Italian 29.35 Weekend 5 29 17 Italian 7.3375 46
1118 1478080 312853 Five Guys Burgers and Fries American 25.27 Weekend 5 27 29 American 6.3175 56
1120 1476729 396481 Han Dynasty Chinese 29.15 Weekend Not given 27 15 Chinese 7.2875 42
1132 1477961 167738 Jack's Wife Freda Mediterranean 31.43 Weekend 5 34 20 Other 7.8575 54
1135 1478041 96456 67 Burger American 29.05 Weekday 5 20 28 American 7.2625 48
1148 1478044 354719 Jack's Wife Freda Mediterranean 31.38 Weekend Not given 28 18 Other 7.8450 46
1149 1477789 185355 Sushi Samba Japanese 22.85 Weekday 5 21 32 Japanese 5.7125 53
1150 1477736 361701 Westville Hudson American 32.93 Weekend 5 30 20 American 8.2325 50
1165 1477634 387227 Blue Ribbon Sushi Bar & Grill Japanese 29.25 Weekday Not given 25 29 Japanese 7.3125 54
1171 1476861 94700 Tamarind TriBeCa Indian 29.15 Weekend 3 35 22 Other 7.2875 57
1172 1476899 335155 Shake Shack American 29.05 Weekend 4 33 16 American 7.2625 49
1173 1478248 113926 Han Dynasty Chinese 33.03 Weekday 5 35 32 Chinese 8.2575 67
1177 1478181 97079 Benihana Japanese 25.22 Weekday 4 27 27 Japanese 6.3050 54
1186 1477474 357761 Go! Go! Curry! Japanese 33.03 Weekend Not given 22 15 Japanese 8.2575 37
1195 1476733 264707 TAO Japanese 32.93 Weekend Not given 34 16 Japanese 8.2325 50
1197 1476825 143866 Otto Enoteca Pizzeria Italian 24.20 Weekend Not given 34 15 Italian 6.0500 49
1203 1477618 184325 Asuka Sushi Japanese 22.80 Weekend Not given 30 28 Japanese 5.7000 58
1213 1476695 68300 Blue Ribbon Fried Chicken American 33.18 Weekend Not given 26 20 American 8.2950 46
1214 1476573 370405 Haveli Indian Restaurant Indian 29.10 Weekday 3 23 24 Other 7.2750 47
1215 1478323 354948 Westville Hudson American 24.25 Weekend Not given 25 21 American 6.0625 46
1216 1477735 302769 Blue Ribbon Fried Chicken American 29.05 Weekend 5 29 20 American 7.2625 49
1218 1478006 42781 Blue Ribbon Sushi Japanese 24.30 Weekday Not given 21 26 Japanese 6.0750 47
1220 1478186 302923 Shake Shack American 20.52 Weekend 3 31 15 American 5.1300 46
1221 1477776 115213 Tamarind TriBeCa Indian 29.39 Weekend 5 30 25 Other 7.3475 55
1227 1477896 42052 Pepe Rosso To Go Italian 22.80 Weekend 5 35 24 Italian 5.7000 59
1230 1477853 115213 Junoon Indian 28.62 Weekday 5 21 32 Other 7.1550 53
1231 1477001 318451 Blue Ribbon Sushi Japanese 29.25 Weekend Not given 22 27 Japanese 7.3125 49
1236 1477393 79849 Parm Italian 22.36 Weekend 4 21 30 Italian 5.5900 51
1239 1477261 76938 Sushi of Gari Japanese 31.43 Weekend Not given 21 27 Japanese 7.8575 48
1240 1478127 78879 Blue Ribbon Fried Chicken American 20.18 Weekend 3 22 20 American 5.0450 42
1244 1476784 105385 Han Dynasty Chinese 24.20 Weekend 5 23 15 Chinese 6.0500 38
1248 1478240 44367 Rubirosa Italian 24.20 Weekend 4 34 16 Italian 6.0500 50
1258 1476900 240014 Sarabeth's American 32.93 Weekday 4 33 33 American 8.2325 66
1260 1477697 362685 Momoya Japanese 29.10 Weekday 4 21 29 Japanese 7.2750 50
1263 1476655 91817 Blue Ribbon Fried Chicken American 29.15 Weekend 4 31 17 American 7.2875 48
1265 1478175 349676 Sarabeth's American 29.30 Weekend 5 23 17 American 7.3250 40
1267 1476697 46219 The Meatball Shop American 32.93 Weekend 3 35 16 American 8.2325 51
1269 1477152 92364 Sushi of Gari 46 Japanese 25.17 Weekend Not given 29 27 Japanese 6.2925 56
1271 1478028 44594 Shake Shack American 24.25 Weekend 5 31 28 American 6.0625 59
1276 1478362 134152 The Meatball Shop Italian 29.10 Weekday 5 22 33 Italian 7.2750 55
1278 1477503 99621 Westville Hudson American 24.30 Weekend Not given 32 15 American 6.0750 47
1280 1478076 96800 Sarabeth's East American 29.30 Weekend Not given 27 20 American 7.3250 47
1285 1477469 96943 Cafe Mogador Middle Eastern 24.25 Weekend Not given 26 22 Other 6.0625 48
1290 1477884 348096 Parm Italian 29.44 Weekend 4 33 24 Italian 7.3600 57
1296 1477924 288808 The Meatball Shop Italian 32.98 Weekday 5 26 27 Italian 8.2450 53
1300 1477153 120353 Parm Italian 25.27 Weekday Not given 27 27 Italian 6.3175 54
1304 1477669 260844 Byblos Restaurant Middle Eastern 25.27 Weekend 3 33 16 Other 6.3175 49
1308 1477143 165695 The Smile American 29.10 Weekend Not given 22 16 American 7.2750 38
1311 1478149 303548 Shake Shack American 25.22 Weekend 3 27 25 American 6.3050 52
1312 1477761 123977 Blue Ribbon Sushi Japanese 24.35 Weekend 5 33 22 Japanese 6.0875 55
1313 1478311 326505 Blue Ribbon Fried Chicken American 21.29 Weekend 5 28 29 American 5.3225 57
1320 1478100 62667 Balthazar Boulangerie French 21.93 Weekend Not given 31 20 Other 5.4825 51
1323 1477553 52037 L'Express French 22.02 Weekday Not given 21 27 Other 5.5050 48
1325 1476692 175327 Nobu Next Door Japanese 29.10 Weekday 3 35 27 Japanese 7.2750 62
1332 1476785 78939 Blue Ribbon Sushi Japanese 24.25 Weekday Not given 29 25 Japanese 6.0625 54
1333 1477182 383826 Song Thai Restaurant & Bar Thai 29.20 Weekend 5 21 28 Other 7.3000 49
1335 1477304 88406 The Meatball Shop Italian 24.20 Weekday 4 28 30 Italian 6.0500 58
1342 1477166 402215 RedFarm Hudson Chinese 21.29 Weekend 4 32 25 Chinese 5.3225 57
1344 1477003 120833 Bareburger American 32.93 Weekend Not given 29 24 American 8.2325 53
1347 1478328 58898 Rubirosa Italian 33.03 Weekend 5 22 28 Italian 8.2575 50
1355 1477370 89889 Sushi of Gari 46 Japanese 29.10 Weekday 5 32 30 Japanese 7.2750 62
1361 1476731 94480 TAO Japanese 29.10 Weekend Not given 28 23 Japanese 7.2750 51
1363 1476777 69749 Blue Ribbon Sushi Japanese 31.38 Weekend Not given 26 27 Japanese 7.8450 53
1364 1478027 41907 Parm Italian 22.75 Weekday Not given 30 27 Italian 5.6875 57
1366 1477184 108659 Rubirosa Italian 32.98 Weekend Not given 33 30 Italian 8.2450 63
1368 1478021 97991 Blue Ribbon Sushi Bar & Grill Japanese 22.26 Weekday Not given 20 26 Japanese 5.5650 46
1370 1478329 116992 Tres Carnes Mexican 33.32 Weekday 4 21 33 Other 8.3300 54
1371 1478385 250494 Blue Ribbon Fried Chicken American 21.34 Weekend 5 28 21 American 5.3350 49
1372 1477300 232359 The Meatball Shop American 31.43 Weekend 4 20 21 American 7.8575 41
1383 1477347 66636 Shake Shack American 20.52 Weekend Not given 31 26 American 5.1300 57
1387 1477180 154339 Chipotle Mexican Grill $1.99 Delivery Mexican 29.15 Weekday Not given 21 24 Other 7.2875 45
1396 1478370 57638 Grand Sichuan International Chinese 25.27 Weekday 5 35 30 Chinese 6.3175 65
1398 1477444 88075 Shake Shack American 24.30 Weekday 4 33 30 American 6.0750 63
1400 1477539 152675 Tres Carnes Mexican 20.13 Weekend Not given 35 18 Other 5.0325 53
1403 1476937 142045 Shake Shack American 22.36 Weekday Not given 33 25 American 5.5900 58
1408 1476778 276192 Sushi of Gari Tribeca Japanese 31.33 Weekday Not given 34 26 Japanese 7.8325 60
1410 1478139 107909 Shake Shack American 24.20 Weekday Not given 22 31 American 6.0500 53
1412 1476694 91105 Cafe Mogador Middle Eastern 29.05 Weekend 4 27 30 Other 7.2625 57
1416 1477813 260844 Byblos Restaurant Middle Eastern 24.20 Weekend Not given 32 20 Other 6.0500 52
1419 1477805 290313 RedFarm Broadway Chinese 21.93 Weekend Not given 22 22 Chinese 5.4825 44
1420 1477305 45846 The Meatball Shop American 24.20 Weekend 5 21 30 American 6.0500 51
1421 1477223 303548 J. G. Melon American 22.26 Weekend 5 22 25 American 5.5650 47
1424 1477861 125320 Shake Shack American 20.57 Weekend 5 24 19 American 5.1425 43
1426 1478253 67345 Parm Italian 25.27 Weekend 5 28 16 Italian 6.3175 44
1429 1478117 56642 Bareburger American 22.85 Weekday Not given 21 30 American 5.7125 51
1432 1477218 333216 Shake Shack American 29.49 Weekend 5 20 24 American 7.3725 44
1434 1476776 125123 Le Grainne Cafe French 29.25 Weekend 5 27 24 Other 7.3125 51
1436 1477878 62730 Westville Hudson American 21.88 Weekend 5 20 15 American 5.4700 35
1439 1478206 108659 Osteria Morini Italian 24.20 Weekday 3 28 28 Italian 6.0500 56
1440 1478326 82901 Il Bambino Italian 29.25 Weekend 4 34 29 Italian 7.3125 63
1442 1477845 127056 Blue Ribbon Sushi Japanese 24.30 Weekday 5 21 33 Japanese 6.0750 54
1454 1477225 140530 Sushi of Gari 46 Japanese 25.22 Weekend Not given 32 28 Japanese 6.3050 60
1455 1477146 49793 Yama Japanese Restaurant Japanese 32.93 Weekend 5 29 17 Japanese 8.2325 46
1457 1477848 276192 12 Chairs Middle Eastern 29.05 Weekday 5 28 32 Other 7.2625 60
1458 1478138 50323 Rubirosa Italian 24.30 Weekend Not given 30 26 Italian 6.0750 56
1461 1477549 297130 L'Express French 29.20 Weekend 5 21 29 Other 7.3000 50
1462 1476932 301032 Mission Cantina Mexican 29.15 Weekend Not given 31 26 Other 7.2875 57
1465 1477258 83287 Blue Ribbon Sushi Izakaya Japanese 29.10 Weekend Not given 32 26 Japanese 7.2750 58
1466 1477849 117033 P.J. Clarke's American 29.20 Weekend Not given 30 22 American 7.3000 52
1472 1477331 384390 El Parador Cafe Mexican 24.20 Weekend Not given 28 18 Other 6.0500 46
1474 1477245 375585 TAO Japanese 24.25 Weekend Not given 31 27 Japanese 6.0625 58
1475 1477006 119465 Cafe Mogador Middle Eastern 25.27 Weekday 5 30 25 Other 6.3175 55
1477 1477341 127122 RedFarm Broadway Chinese 22.36 Weekend Not given 24 27 Chinese 5.5900 51
1478 1477967 101241 Empanada Mama (closed) Mexican 24.30 Weekday Not given 25 24 Other 6.0750 49
1483 1477179 52832 L'Express French 24.20 Weekday Not given 28 24 Other 6.0500 52
1485 1477074 317904 Rubirosa Italian 31.67 Weekend Not given 25 15 Italian 7.9175 40
1486 1478051 139639 Sushi of Gari 46 Japanese 24.30 Weekend 3 29 23 Japanese 6.0750 52
1487 1477071 78939 Nobu Next Door Japanese 29.05 Weekend 5 33 29 Japanese 7.2625 62
1492 1476707 144133 Shake Shack American 22.75 Weekday 4 21 27 American 5.6875 48
1497 1477589 214028 Boqueria Spanish 29.05 Weekend 4 24 24 Other 7.2625 48
1499 1478043 264707 The Meatball Shop Italian 29.20 Weekend 5 29 23 Italian 7.3000 52
1500 1476665 41246 Shake Shack American 24.20 Weekend Not given 25 24 American 6.0500 49
1501 1477298 361728 The Meatball Shop Italian 29.05 Weekend 4 32 19 Italian 7.2625 51
1506 1477733 376499 Lucky Strike American 29.25 Weekend 4 21 21 American 7.3125 42
1512 1478176 240982 Rubirosa Italian 29.10 Weekend 5 28 16 Italian 7.2750 44
1513 1476818 195927 Boqueria Spanish 29.10 Weekend Not given 28 19 Other 7.2750 47
1514 1477435 154030 Hatsuhana Japanese 29.49 Weekend 4 22 23 Japanese 7.3725 45
1516 1477465 361220 Carmine's Italian 21.93 Weekend 5 20 28 Italian 5.4825 48
1522 1477683 279715 RedFarm Hudson Chinese 21.34 Weekend Not given 23 17 Chinese 5.3350 40
1526 1478325 399373 Shake Shack American 29.10 Weekday 4 29 24 American 7.2750 53
1541 1478322 57943 RedFarm Broadway Chinese 24.25 Weekday 5 25 25 Chinese 6.0625 50
1546 1477632 76942 Sarabeth's Restaurant American 29.15 Weekday Not given 20 26 American 7.2875 46
1552 1476865 297232 Empanada Mama (closed) Mexican 31.38 Weekend 5 24 18 Other 7.8450 42
1556 1477775 142461 Shake Shack American 29.25 Weekend 4 25 19 American 7.3125 44
1557 1478007 113238 Boqueria Spanish 24.25 Weekend Not given 28 18 Other 6.0625 46
1564 1478079 54608 Tamarind TriBeCa Indian 25.22 Weekend 5 30 26 Other 6.3050 56
1565 1478144 155124 The Meatball Shop Italian 33.03 Weekend 5 30 16 Italian 8.2575 46
1566 1476615 338599 RedFarm Hudson Chinese 29.44 Weekday 4 29 32 Chinese 7.3600 61
1570 1476924 153048 Shake Shack American 21.83 Weekend Not given 28 23 American 5.4575 51
1574 1477436 88853 RedFarm Hudson Chinese 29.29 Weekend 4 27 21 Chinese 7.3225 48
1579 1477695 302131 Rubirosa Italian 24.20 Weekend Not given 33 28 Italian 6.0500 61
1581 1478375 214028 Boqueria Spanish 22.85 Weekend 5 28 30 Other 5.7125 58
1582 1476965 276192 Delicatessen American 24.20 Weekend 4 21 19 American 6.0500 40
1586 1477949 385023 Rubirosa Italian 24.35 Weekend 3 30 28 Italian 6.0875 58
1596 1477111 127149 P.J. Clarke's American 31.33 Weekend 4 26 19 American 7.8325 45
1597 1477818 144352 Shake Shack American 22.36 Weekend 4 27 27 American 5.5900 54
1598 1477249 351561 The Kati Roll Company Indian 20.13 Weekday Not given 24 31 Other 5.0325 55
1600 1477379 145962 Joe's Shanghai Ž_ÀŽü£¾÷´ Chinese 22.31 Weekday 3 27 31 Chinese 5.5775 58
1603 1477707 133330 Blue Ribbon Fried Chicken American 25.27 Weekend 5 29 28 American 6.3175 57
1605 1476614 138462 Chipotle Mexican Grill $1.99 Delivery Mexican 29.10 Weekday 5 21 29 Other 7.2750 50
1610 1476754 229946 Balthazar Boulangerie French 21.25 Weekend Not given 25 20 Other 5.3125 45
1611 1477260 229946 Chipotle Mexican Grill $1.99 Delivery Mexican 29.10 Weekend 4 27 25 Other 7.2750 52
1612 1478297 180618 Bareburger American 24.20 Weekend 5 27 24 American 6.0500 51
1615 1477820 41746 Schnipper's Quality Kitchen American 25.22 Weekend 4 33 18 American 6.3050 51
1616 1478291 385134 RedFarm Broadway Chinese 31.87 Weekend 5 27 18 Chinese 7.9675 45
1625 1477918 62912 Yama Japanese Restaurant Japanese 24.25 Weekday Not given 23 30 Japanese 6.0625 53
1627 1476847 114085 The Meatball Shop Italian 24.30 Weekend 4 29 15 Italian 6.0750 44
1628 1477081 222734 Shake Shack American 24.25 Weekday Not given 23 30 American 6.0625 53
1635 1478142 114085 Hatsuhana Japanese 29.15 Weekend 3 33 28 Japanese 7.2875 61
1638 1476960 45577 Parm Italian 21.83 Weekday Not given 23 32 Italian 5.4575 55
1639 1478134 82041 Sushi of Gari Tribeca Japanese 21.83 Weekday Not given 34 30 Japanese 5.4575 64
1640 1477588 286386 5 Napkin Burger American 29.05 Weekend 3 26 21 American 7.2625 47
1642 1477217 139639 Sushi of Gari 46 Japanese 29.15 Weekday Not given 32 32 Japanese 7.2875 64
1646 1477665 231061 Han Dynasty Chinese 34.19 Weekday Not given 21 31 Chinese 8.5475 52
1651 1477886 241310 Blue Ribbon Sushi Japanese 32.93 Weekday 3 34 31 Japanese 8.2325 65
1653 1477434 77857 Shake Shack American 29.15 Weekend 5 20 21 American 7.2875 41
1657 1476571 334758 Melt Shop American 29.15 Weekend 4 26 17 American 7.2875 43
1658 1477034 259341 J. G. Melon American 29.05 Weekend Not given 26 28 American 7.2625 54
1659 1477673 132906 Sushi of Gari 46 Japanese 22.46 Weekday Not given 21 29 Japanese 5.6150 50
1662 1478113 74048 ilili Restaurant Middle Eastern 25.22 Weekday 4 32 25 Other 6.3050 57
1663 1477986 115213 Junoon Indian 22.75 Weekend 5 29 28 Other 5.6875 57
1668 1478442 378035 Five Guys Burgers and Fries American 29.73 Weekend 5 21 25 American 7.4325 46
1670 1477476 276192 Delicatessen American 32.93 Weekend 4 30 18 American 8.2325 48
1671 1477520 178158 Chipotle Mexican Grill $1.99 Delivery Mexican 31.33 Weekend 4 35 21 Other 7.8325 56
1679 1476938 164776 TAO Japanese 25.27 Weekday Not given 33 30 Japanese 6.3175 63
1682 1478361 371117 Shake Shack American 29.10 Weekend 5 26 24 American 7.2750 50
1688 1478074 41638 Blue Ribbon Fried Chicken American 29.05 Weekend 5 30 29 American 7.2625 59
1690 1477181 302790 Carmine's Italian 29.05 Weekday Not given 33 32 Italian 7.2625 65
1692 1476870 94524 The Meatball Shop Italian 24.30 Weekend 5 28 25 Italian 6.0750 53
1696 1476574 376993 Emporio Italian 31.43 Weekend Not given 25 29 Italian 7.8575 54
1708 1477402 377481 Otto Enoteca Pizzeria Italian 24.25 Weekday Not given 31 30 Italian 6.0625 61
1709 1476760 180776 Empanada Mama (closed) Mexican 22.75 Weekend Not given 29 18 Other 5.6875 47
1710 1477030 240982 Rubirosa Italian 24.30 Weekday 3 29 31 Italian 6.0750 60
1714 1477448 142574 Sushi of Gari Japanese 22.75 Weekend 5 30 22 Japanese 5.6875 52
1715 1477784 146555 Momoya Japanese 24.30 Weekend 5 28 20 Japanese 6.0750 48
1717 1477031 201471 Friend of a Farmer American 24.20 Weekend Not given 33 27 American 6.0500 60
1727 1477551 277898 Blue Ribbon Fried Chicken American 29.44 Weekend 4 33 27 American 7.3600 60
1731 1477891 142461 Shake Shack American 25.22 Weekend Not given 28 26 American 6.3050 54
1734 1477082 107909 ilili Restaurant Middle Eastern 24.20 Weekday 4 34 24 Other 6.0500 58
1738 1478397 121706 Blue Ribbon Fried Chicken American 24.30 Weekend 5 22 15 American 6.0750 37
1740 1478241 60052 RedFarm Broadway Chinese 24.20 Weekend 5 31 19 Chinese 6.0500 50
1741 1477216 259341 Momoya Japanese 29.35 Weekday Not given 31 30 Japanese 7.3375 61
1744 1477732 399729 Shake Shack American 24.25 Weekend 4 20 29 American 6.0625 49
1748 1476989 64401 The Meatball Shop Italian 21.34 Weekday 5 22 24 Italian 5.3350 46
1752 1478360 375043 Tamarind TriBeCa Indian 24.20 Weekend Not given 24 29 Other 6.0500 53
1759 1478243 159626 Blue Ribbon Sushi Japanese 29.10 Weekend 4 21 15 Japanese 7.2750 36
1761 1476953 252342 Westville Hudson American 20.13 Weekend 4 29 19 American 5.0325 48
1762 1477700 60039 Blue Ribbon Sushi Japanese 33.37 Weekday 3 30 27 Japanese 8.3425 57
1763 1478106 129206 Shake Shack American 29.15 Weekday Not given 34 28 American 7.2875 62
1765 1478213 122092 Han Dynasty Chinese 22.31 Weekend 3 23 29 Chinese 5.5775 52
1766 1476779 378820 Sushi Samba Japanese 31.33 Weekend 5 35 20 Japanese 7.8325 55
1767 1478207 62161 Tamarind TriBeCa Indian 24.20 Weekend 4 28 26 Other 6.0500 54
1768 1477075 52832 ilili Restaurant Middle Eastern 31.43 Weekday 3 26 29 Other 7.8575 55
1769 1477145 207281 Shake Shack American 29.30 Weekday 5 33 32 American 7.3250 65
1776 1477694 192317 Shake Shack American 24.30 Weekend 4 25 15 American 6.0750 40
1780 1477144 62667 Balthazar Boulangerie French 29.10 Weekend 5 31 27 Other 7.2750 58
1782 1478182 135970 Momoya Japanese 25.27 Weekday 5 31 30 Japanese 6.3175 61
1785 1477857 363202 S'MAC American 25.27 Weekend 5 20 29 American 6.3175 49
1786 1476840 143866 Jack's Wife Freda Mediterranean 20.71 Weekend Not given 35 16 Other 5.1775 51
1787 1477641 128224 Blue Ribbon Sushi Japanese 24.20 Weekend 4 29 18 Japanese 6.0500 47
1788 1476690 124875 Vanessa's Dumplings Chinese 24.20 Weekend 4 20 18 Chinese 6.0500 38
1789 1476593 175703 The Meatball Shop Italian 20.61 Weekend Not given 34 30 Italian 5.1525 64
1794 1476976 300552 Shake Shack American 22.26 Weekday 5 33 32 American 5.5650 65
1795 1476575 141912 P.J. Clarke's American 31.38 Weekend Not given 31 23 American 7.8450 54
1796 1478105 143721 Hummus Place Middle Eastern 29.05 Weekend 5 26 17 Other 7.2625 43
1799 1477259 145952 Blue Ribbon Sushi Japanese 29.15 Weekend 4 31 19 Japanese 7.2875 50
1800 1477141 66331 Shake Shack American 24.30 Weekend 5 21 24 American 6.0750 45
1802 1478254 239985 5 Napkin Burger American 25.22 Weekend 5 27 21 American 6.3050 48
1803 1478365 60039 ilili Restaurant Middle Eastern 32.93 Weekend 4 25 17 Other 8.2325 42
1804 1477380 108659 Rubirosa Italian 25.27 Weekday 4 23 31 Italian 6.3175 54
1806 1478444 355090 Shake Shack American 31.43 Weekend 3 22 24 American 7.8575 46
1810 1477526 344079 Olea Mediterranean 24.20 Weekend Not given 20 16 Other 6.0500 36
1811 1477664 47440 Blue Ribbon Fried Chicken American 29.30 Weekend 4 28 16 American 7.3250 44
1812 1477917 71249 Momoya Japanese 24.30 Weekend 4 35 30 Japanese 6.0750 65
1813 1477381 316223 The Smile American 25.22 Weekday 4 25 28 American 6.3050 53
1815 1477885 178158 Chipotle Mexican Grill $1.99 Delivery Mexican 29.10 Weekday 4 22 32 Other 7.2750 54
1816 1476724 130956 Blue Ribbon Sushi Japanese 21.83 Weekday 3 21 26 Japanese 5.4575 47
1821 1478364 273690 Grand Sichuan International Chinese 32.93 Weekend Not given 32 28 Chinese 8.2325 60
1822 1477480 75722 Yama 49 Japanese 22.31 Weekend 5 29 17 Japanese 5.5775 46
1825 1477633 378753 Shake Shack American 29.10 Weekend 5 29 17 American 7.2750 46
1830 1478369 243341 Sushi Samba Japanese 22.36 Weekend 5 31 30 Japanese 5.5900 61
1831 1476970 275689 Nobu Next Door Japanese 33.37 Weekend 4 32 21 Japanese 8.3425 53
1845 1477966 318451 Blue Ribbon Sushi Japanese 24.30 Weekend Not given 29 15 Japanese 6.0750 44
1847 1477855 5139 Sushi of Gari 46 Japanese 22.26 Weekend 5 28 22 Japanese 5.5650 50
1851 1477871 124875 Shake Shack American 21.39 Weekend 3 33 22 American 5.3475 55
1858 1477335 84457 Nobu Next Door Japanese 29.15 Weekend Not given 27 15 Japanese 7.2875 42
1860 1477330 198802 DuMont Burger American 24.25 Weekend 3 28 20 American 6.0625 48
1863 1477076 68834 Sushi of Gari 46 Japanese 31.43 Weekend 5 29 30 Japanese 7.8575 59
1864 1476939 111894 The Meatball Shop Italian 25.27 Weekend Not given 25 29 Italian 6.3175 54
1866 1478268 306119 Xi'an Famous Foods Chinese 20.86 Weekend 4 35 26 Chinese 5.2150 61
1868 1477778 100889 RedFarm Broadway Chinese 31.43 Weekend 4 30 23 Chinese 7.8575 53
1872 1477000 328731 Blue Ribbon Fried Chicken American 29.59 Weekend 5 23 25 American 7.3975 48
1873 1478148 261371 Shake Shack American 22.31 Weekend Not given 35 28 American 5.5775 63
1884 1477437 304993 Shake Shack American 31.43 Weekend 3 31 24 American 7.8575 55
1885 1477550 97324 Shake Shack American 29.05 Weekday 4 27 29 American 7.2625 56
1892 1477473 97838 Han Dynasty Chinese 29.15 Weekend Not given 29 21 Chinese 7.2875 50
1893 1476701 292602 Chipotle Mexican Grill $1.99 Delivery Mexican 22.31 Weekend 5 31 17 Other 5.5775 48
1895 1477819 35309 Blue Ribbon Sushi Japanese 25.22 Weekday Not given 31 24 Japanese 6.3050 55

Calculate the percentage orders where the cost is above 20 dollars

percentage_df_greater_than_20 = (num_df_greater_than_20 / df.shape[0]) * 100
print(percentage_df_greater_than_20)
29.24130663856691
Question 10: What is the mean order delivery time?

Get the mean delivery time

mean_delivery_time = df['delivery_time'].mean()
print('The mean delivery time for this dataset is', round(mean_delivery_time, 2), 'minutes')
The mean delivery time for this dataset is 24.16 minutes
Question 11: The company has decided to give 20% discount vouchers to the top 3 most frequent customers. Find the IDs of these customers and the number of orders they placed

Get top 3 most frequent customers

df['customer_id'].value_counts().head(3)
count
customer_id
52832 13
47440 10
83287 9
dtype: int64
Question 12: Perform a multivariate analysis to explore relationships between the important variables in the dataset. (It is a good idea to explore relations between numerical variables as well as relations between numerical and categorical variables)
Cuisine vs Cost of the order

Relationship between cost of the order and cuisine type

plt.figure(figsize=(15,7))
plt.title('Relationship between cost of the order and cuisine type', fontsize=15, color='gold')
plt.xlabel('Cuisine Type', fontsize=13, color='darkkhaki')
plt.ylabel('Cost of the Order', fontsize=13, color='mediumorchid')
sns.boxplot(x='cuisine_type', y='cost_of_the_order', data=df, palette='Oranges')
plt.xticks(rotation = 45)
:6: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.boxplot(x='cuisine_type', y='cost_of_the_order', data=df, palette='Oranges')
([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
[Text(0, 0, 'Korean'),
Text(1, 0, 'Japanese'),
Text(2, 0, 'Mexican'),
Text(3, 0, 'American'),
Text(4, 0, 'Indian'),
Text(5, 0, 'Italian'),
Text(6, 0, 'Mediterranean'),
Text(7, 0, 'Chinese'),
Text(8, 0, 'Middle Eastern'),
Text(9, 0, 'Thai'),
Text(10, 0, 'Southern'),
Text(11, 0, 'French'),
Text(12, 0, 'Spanish'),
Text(13, 0, 'Vietnamese')])

Filter the DataFrame for Southern cuisine

southern_restaurants = df[df['cuisine_type'] == 'Southern']['restaurant_name'].unique()

Print the list of Southern restaurants

print("Restaurants serving Southern cuisine:")
for restaurant in southern_restaurants:
print(restaurant)
Restaurants serving Southern cuisine:
Hill Country Fried Chicken
Amy Ruth's

Calculate number of american restaurants

Filter the DataFrame for American cuisine

american_restaurants = df[df['cuisine_type'] == 'American']['restaurant_name'].unique()

Print the number of American restaurants

print("Number of restaurants serving American cuisine:", len(american_restaurants))
Number of restaurants serving American cuisine: 41

Filter the DataFrame for American cuisine

american_restaurants = df[df['cuisine_type'] == 'American']['restaurant_name'].unique()

Print the list of American restaurants

print("Restaurants serving American cuisine:")
for restaurant in american_restaurants:
print(restaurant)
Restaurants serving American cuisine:
Blue Ribbon Fried Chicken
Dirty Bird to Go
Lucky's Famous Burgers
Shake Shack
Five Guys Burgers and Fries
5 Napkin Burger
Cafeteria
DuMont Burger
Sarabeth's East
Westville Hudson
Blue Ribbon Brooklyn
Bareburger
The Odeon
The Meatball Shop
Five Leaves
Delicatessen
S'MAC
Waverly Diner
P.J. Clarke's
The Smile
Bubby's
Dirty Bird To Go (archived)
Burger Joint
Sarabeth's Restaurant
Melt Shop
J. G. Melon
Friend of a Farmer
Dickson's Farmstand Meats
Dig Inn Seasonal Market
Alidoro
brgr
Sarabeth's
Big Daddy's
Moonstruck on Second
67 Burger
Schnipper's Quality Kitchen
Market Table
Lucky Strike
Rye House
Sarabeth's West
'wichcraft
Cuisine vs Food Preparation time

Correlate food preparation time and cuisine type

plt.figure(figsize=(15,7))
plt.title('Relationship between food preparation time and cuisine type', fontsize=15, color='gold')
plt.xlabel('Cuisine Type', fontsize=13, color='crimson')
plt.ylabel('Food Preparation Time', fontsize=13, color='purple')
plt.xticks(rotation=45)
sns.boxplot(x='cuisine_type', y='food_preparation_time', data=df, palette='inferno')
:7: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.boxplot(x='cuisine_type', y='food_preparation_time', data=df, palette='inferno')

Correlate food preparation time and cuisine type

plt.figure(figsize=(15,7))
plt.title('Relationship between food preparation time and cuisine type', fontsize=15, color='darkorchid')
plt.xlabel('Cuisine Type', fontsize=13, color='crimson')
plt.ylabel('Food Preparation Time', fontsize=13, color='purple')
plt.xticks(rotation=45)
sns.violinplot(x='cuisine_type', y='food_preparation_time', edgecolor='gold', data=df, palette='inferno')
:7: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.violinplot(x='cuisine_type', y='food_preparation_time', edgecolor='gold', data=df, palette='inferno')

Correlate food preparation time and rating violin

Relationship between food preparation time and rating

plt.figure(figsize=(15,7))
plt.title('Relationship between food preparation time and rating', fontsize=15, color='darkviolet')
plt.xlabel('Rating', fontsize=13, color='crimson')
plt.ylabel('Food Preparation Time', fontsize=13, color='purple')
plt.xticks(rotation=45)
sns.violinplot(x='rating', y='food_preparation_time', data=df, edgecolor='gold', palette='plasma')
:9: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.violinplot(x='rating', y='food_preparation_time', data=df, edgecolor='gold', palette='plasma')

Day of the Week vs Delivery time

Correlate rating and delivery time

plt.figure(figsize=(15, 7))
plt.title('Relationship between rating and delivery time', fontsize=15, color='gold')
plt.xlabel('Rating', fontsize=13, color='orange')
plt.ylabel('Delivery Time', fontsize=13, color='purple')
sns.pointplot(x='rating', y='delivery_time', data=df, palette='plasma')
:6: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.pointplot(x='rating', y='delivery_time', data=df, palette='plasma')

Correlate day of the week and delivery time

plt.figure(figsize=(15,7))
plt.title('Relationship between day of the week and delivery time', fontsize=15, color='gold')
plt.xlabel('Day of the Week', fontsize=13, color='orange')
plt.ylabel('Delivery Time', fontsize=13, color='purple')
sns.boxplot(x='day_of_the_week', y='delivery_time', data=df, palette='plasma')
:6: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.boxplot(x='day_of_the_week', y='delivery_time', data=df, palette='plasma')

Calculate mean delivery time on weekend

mean_delivery_time_weekend = df[df['day_of_the_week'] == 'Weekend']['delivery_time'].mean()
print("Mean delivery time on weekends: {:.2f} minutes".format(mean_delivery_time_weekend))
Mean delivery time on weekends: 22.47 minutes

Calculate mean delivery time on weekday

mean_delivery_time_weekday = df[df['day_of_the_week'] == 'Weekday']['delivery_time'].mean()
print("Mean delivery time on weekdays: {:.2f} minutes".format(mean_delivery_time_weekday))
Mean delivery time on weekdays: 28.34 minutes

Calculate the percentage difference mean delivery on weekday to weekend

percentage_difference = ((mean_delivery_time_weekday - mean_delivery_time_weekend) / mean_delivery_time_weekend) * 100
print("Mean delivery time on weekdays is {:.2f}% greater than on weekends.".format(percentage_difference))
Mean delivery time on weekdays is 26.12% greater than on weekends.
Run the below code and write your observations on the revenue generated by the restaurants
My observation is that Shake Shack is the most popular restaurant, followed by The Meatball Shop, Blue Ribbon Sushi and Blue Ribbon Fried Chicken.

df.groupby(['restaurant_name'])['cost_of_the_order'].sum().sort_values(ascending = False).head(14)
cost_of_the_order
restaurant_name
Shake Shack 3579.53
The Meatball Shop 2145.21
Blue Ribbon Sushi 1903.95
Blue Ribbon Fried Chicken 1662.29
Parm 1112.76
RedFarm Broadway 965.13
RedFarm Hudson 921.21
TAO 834.50
Han Dynasty 755.29
Blue Ribbon Sushi Bar & Grill 666.62
Rubirosa 660.45
Sushi of Gari 46 640.87
Nobu Next Door 623.67
Five Guys Burgers and Fries 506.47
dtype: float64
Rating vs Delivery time
Rating vs Food preparation time
Rating vs Cost of the order

Relationship between rating and cost of the order

plt.figure(figsize=(15, 7))
plt.title('Relationship between rating and cost of the order', fontsize=15, color='darkviolet')
plt.xlabel('Rating', fontsize=13, color='orange')
plt.ylabel('Cost of the Order', fontsize=13, color='purple')
sns.violinplot(x='rating', y='cost_of_the_order', data=df, edgecolor='goldenrod', palette='Purples')
:6: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the x variable to hue and set legend=False for the same effect.

sns.violinplot(x='rating', y='cost_of_the_order', data=df, edgecolor='goldenrod', palette='Purples')

Correlation among variables

Plot the heatmap

col_list = ['cost_of_the_order', 'food_preparation_time', 'delivery_time']
plt.figure(figsize=(15, 7))
sns.heatmap(df[col_list].corr(), annot=True, vmin=-1, vmax=1, fmt='.2f', cmap='Spectral')

Question 13: The company wants to provide a promotional offer in the advertisement of the restaurants. The condition to get the offer is that the restaurants must have a rating count of more than 50 and the average rating should be greater than 4. Find the restaurants fulfilling the criteria to get the promotional offer

Filter the DataFrame for ratings 4 and above

df_rated = df[df['rating'].isin(['4', '5']) ]

Filter the rated restaurants

df_filtered = df[df['rating'] != 'Not given'].copy()

Convert rating column from object to integer

df_rated['rating'] = df_rated['rating'].astype('int')

Create a dataframe that contains the restaurant names with their rating counts

df_rating_count = df_rated.groupby(['restaurant_name'])['rating'].count().sort_values(ascending = False).reset_index()
df_rating_count.head()
:8: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df_rated['rating'] = df_rated['rating'].astype('int')
restaurant_name rating
0 Shake Shack 110
1 The Meatball Shop 74
2 Blue Ribbon Sushi 57
3 Blue Ribbon Fried Chicken 53
4 RedFarm Broadway 33

Calculate the average rating for each restaurant

average_ratings = df_rated.groupby('restaurant_name')['rating'].mean().reset_index()
average_ratings.rename(columns={'rating': 'average_rating'}, inplace=True)

Merge the average ratings with the rating counts

df_rating_summary = pd.merge(df_rating_count, average_ratings, on='restaurant_name')

Filter restaurants with more than 50 ratings and average rating greater than 4

promo_restaurants = df_rating_summary[(df_rating_summary['rating'] > 50) & (df_rating_summary['average_rating'] > 4)]

Create a visually appealing plot

plt.figure(figsize=(15, 7))
plt.title('Restaurants Eligible for Promotion', fontsize=15, color='darkviolet')
plt.xlabel('Number of Ratings (Above 4 or 5)', fontsize=13, color='orange')
plt.ylabel('Restaurant Name', fontsize=13, color='purple')
plt.grid(axis='x')
sns.barplot(x='rating', y='restaurant_name', data=promo_restaurants, palette='YlOrRd')
:17: FutureWarning:

Passing palette without assigning hue is deprecated and will be removed in v0.14.0. Assign the y variable to hue and set legend=False for the same effect.

sns.barplot(x='rating', y='restaurant_name', data=promo_restaurants, palette='YlOrRd')

Get the restaurant names that have rating count more than 50

rest_names = df_rating_count[df_rating_count['rating'] > 50]['restaurant_name']

Filter to get the data of restaurants that have rating count more than 50

df_mean_4 = df_rated[df_rated['restaurant_name'].isin(rest_names)].copy()

Group the restaurant names with their ratings and find the mean rating of each restaurant

df_mean_4.groupby(['restaurant_name'])['rating'].mean().sort_values(ascending = False).reset_index().dropna()
restaurant_name rating
0 The Meatball Shop 4.716216
1 Blue Ribbon Fried Chicken 4.603774
2 Blue Ribbon Sushi 4.561404
3 Shake Shack 4.545455
Question 14: The company charges the restaurant 25% on the orders having cost greater than 20 dollars and 15% on the orders having cost greater than 5 dollars. Find the net revenue generated by the company across all orders

Determine the revenue

def compute_rev(x):
if x > 20:
return x*0.25
elif x > 5:
return x*0.15
else:
return x*0
df['Revenue'] = df['cost_of_the_order'].apply(compute_rev)
df.head()
order_id customer_id restaurant_name cuisine_type cost_of_the_order day_of_the_week rating food_preparation_time delivery_time cuisine_popular Revenue
0 1477147 337525 Hangawi Korean 30.75 Weekend Not given 25 20 Other 7.6875
1 1477685 358141 Blue Ribbon Sushi Izakaya Japanese 12.08 Weekend Not given 25 23 Japanese 1.8120
2 1477070 66393 Cafe Habana Mexican 12.23 Weekday 5 23 28 Other 1.8345
3 1477334 106968 Blue Ribbon Fried Chicken American 29.20 Weekend 3 25 15 American 7.3000
4 1478249 76942 Dirty Bird to Go American 11.59 Weekday 4 25 24 American 1.7385

Calculate revenue from orders over 20 dollars

revenue_over_20 = df[df['cost_of_the_order'] > 20]['cost_of_the_order'].sum() * 0.25

Calculate revenue from orders between 5 and 20 dollars

revenue_5_to_20 = df[(df['cost_of_the_order'] > 5) & (df['cost_of_the_order'] <= 20)]['cost_of_the_order'].sum() * 0.15

Calculate total net revenue

net_revenue = revenue_over_20 + revenue_5_to_20

print("Net revenue generated by the company: $", round(net_revenue, 2))
Net revenue generated by the company: $ 6166.3

Calculate the total revenue

total_revenue = df['Revenue'].sum()
print("The net revenue generated by the company is $",round(total_revenue,2))
The net revenue generated by the company is $ 6166.3

Group the data by restaurant name and calculate the total revenue for each restaurant

revenue_by_restaurant = df.groupby('restaurant_name')['Revenue'].sum().sort_values(ascending=False)

Calculate the percentage of revenue for each restaurant

revenue_percentage = revenue_by_restaurant / revenue_by_restaurant.sum() * 100

Filter out restaurants with less than 3% revenue

revenue_above_3_percent = revenue_percentage[revenue_percentage >= 3]

Create a pie chart

plt.figure(figsize=(10, 10))
plt.pie(revenue_above_3_percent, labels=revenue_above_3_percent.index, autopct='%1.1f%%', startangle=90)
plt.title('Revenue Distribution by Restaurant (Above 3%)')
Text(0.5, 1.0, 'Revenue Distribution by Restaurant (Above 3%)')

Create a pie chart without percentages or labels

plt.figure(figsize=(10, 10))
plt.pie(revenue_by_restaurant)
plt.title('Revenue Distribution by Restaurant')
Text(0.5, 1.0, 'Revenue Distribution by Restaurant')

prompt: remove restaurant names # Group the data by restaurant name and calculate the total revenue for each restaurant

revenue_by_restaurant = df.groupby('restaurant_name')['Revenue'].sum().sort_values(ascending=False)

# Create a pie chart

plt.figure(figsize=(10, 10))

plt.pie(revenue_by_restaurant, labels=revenue_by_restaurant.index, autopct='%1.1f%%', startangle=90)

plt.title('Revenue Distribution by R

Group the data by restaurant name and calculate the total revenue for each restaurant

revenue_by_restaurant = df.groupby('restaurant_name')['Revenue'].sum().sort_values(ascending=False)

Create a pie chart

plt.figure(figsize=(10, 10))
plt.pie(revenue_by_restaurant, labels=None, autopct='%1.1f%%', startangle=90)
plt.title('Revenue Distribution by Restaurant')
plt.legend(revenue_by_restaurant.index, loc='center left', bbox_to_anchor=(1, 0.5))

/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 142 (\x8e) missing from current font.
func(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 140 (\x8c) missing from current font.
func(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 142 (\x8e) missing from current font.
fig.canvas.print_figure(bytes_io, **kw)
/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 140 (\x8c) missing from current font.
fig.canvas.print_figure(bytes_io, **kw)

prompt: beautiful 3d scatter plot of company revenue

!pip install plotly
import plotly.express as px

Assuming 'df' is your DataFrame and 'Revenue' is the column with revenue values

Create a 3D scatter plot

fig = px.scatter_3d(df, x='cost_of_the_order', y='delivery_time', z='Revenue',
color='cuisine_type', size='Revenue',
opacity=0.7, title='Company Revenue by Order Cost, Delivery Time, and Cuisine')

Customize the appearance

fig.update_layout(scene=dict(xaxis_title='Order Cost',
yaxis_title='Delivery Time',
zaxis_title='Revenue'))

Display the plot

fig.show()
Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (5.15.0)
Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly) (9.0.0)
Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from plotly) (24.1)
Question 15: The company wants to analyze the total time required to deliver the food. What percentage of orders take more than 60 minutes to get delivered from the time the order is placed? (The food has to be prepared and then delivered)

Calculate total delivery time and add a new column to the dataframe df to store the total delivery time

df['total_time'] = df['food_preparation_time'] + df['delivery_time']

Calculate the number of orders that take more than 60 minutes

num_orders_over_60 = df[df['total_time'] > 60].shape[0]

Calculate the percentage of orders that take more than 60 minutes

percentage_over_60 = (num_orders_over_60 / df.shape[0]) * 100

print("Percentage of orders taking more than 60 minutes to deliver:", round(percentage_over_60, 2), '%')
Percentage of orders taking more than 60 minutes to deliver: 10.54 %
Question 16: The company wants to analyze the delivery time of the orders on weekdays and weekends. How does the mean delivery time vary during weekdays and weekends?

Get the mean delivery time on weekdays and print it

print('The mean delivery time on weekdays is around',
round(df[df['day_of_the_week'] == 'Weekday']['delivery_time'].mean()),
'minutes')
The mean delivery time on weekdays is around 28 minutes

Get the mean delivery time on weekends and print it

print('The mean delivery time on weekends is around',
round(df[df['day_of_the_week'] == 'Weekend']['delivery_time'].mean()),
'minutes')
The mean delivery time on weekends is around 22 minutes
Conclusion and Recommendations
Question 17: What are your conclusions from the analysis? What recommendations would you like to share to help improve the business? (You can use cuisine type and feedback ratings to drive your business recommendations)
Conclusions: Make your own
Recommendations: Have fun

Top comments (0)