0% found this document useful (0 votes)
2 views51 pages

MLS 5 - Python Project Support

The document serves as an introduction to Python programming and exploratory data analysis (EDA), outlining key concepts, statistical measures, and data visualization techniques. It includes quizzes to assess understanding of data analysis steps, loading datasets, and statistical measures like mean, median, and correlation. Additionally, it emphasizes the importance of data visualization for interpreting and presenting data effectively.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views51 pages

MLS 5 - Python Project Support

The document serves as an introduction to Python programming and exploratory data analysis (EDA), outlining key concepts, statistical measures, and data visualization techniques. It includes quizzes to assess understanding of data analysis steps, loading datasets, and statistical measures like mean, median, and correlation. Additionally, it emphasizes the importance of data visualization for interpreting and presenting data effectively.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to Python - Project Support

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Getting Started with Data Analysis

Common Statistical Measures

Significance of Data Visualization


Agenda
maitrayeeb@[Link]
KAP934JM0X
Choosing plots for Univariate/Bivariate Analysis

FoodHub - Business Context & objective

FoodHub - Submission Guidelines

FoodHub - Q/A

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Let’s begin the discussion by answering a few questions on
maitrayeeb@[Link]
Python programming and Exploratory Data Analysis
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Which of the following represents the correct sequence of steps to begin data
analysis?

A Import Libraries => EDA => Load dataset


maitrayeeb@[Link]
KAP934JM0X

B Load dataset => Import Libraries => EDA

D Import Libraries => Load dataset => EDA

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Which of the following represents the correct sequence of steps to begin data
analysis?

A Import Libraries => EDA => Load dataset


maitrayeeb@[Link]
KAP934JM0X

B Load dataset => Import Libraries => EDA

D Import Libraries => Load dataset => EDA

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Getting Started with Data Analysis

1 Importing Packages Loading the Dataset 2


Using pandas functions, we load the dataset in a
In this step, we import all the necessary packages dataframe. For csv files, ‘pd.read_csv( )’ is used.
such as numpy, pandas, matplotlib, seaborn etc. For excel files, ‘pd.read_excel( )’ is used.
maitrayeeb@[Link]
KAP934JM0X

3 Exploratory Data Analysis

In this step, we look for the shape of the dataset, the different data
types, check for anomalous and missing values, and analyse the
attributes individually as well as relationships between them through
visualizations to identify key business insights

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Consider the file foodhub_order.csv stored in the following folder hierarchy


Python => Project => Dataset
Which of the following code snippets is the correct way to load the file into a
pandas dataframe in Google Colab?

maitrayeeb@[Link]
KAP934JM0X A df = pd.read_csv("Python/Project/Dataset/foodhub_order.csv")

B df = pd.read_csv("Python\Project\Dataset\foodhub_order.csv")

C df = pd.read_csv("Python//Project//Dataset//foodhub_order.csv")

D df = pd.read_csv("Python\\Project\\Dataset\\foodhub_order.csv")
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Consider the file foodhub_order.csv stored in the following folder hierarchy


Python => Project => Dataset
Which of the following code snippets is the correct way to load the file into a
pandas dataframe in Google Colab?

maitrayeeb@[Link]
KAP934JM0X A df = pd.read_csv("Python/Project/Dataset/foodhub_order.csv")

B df = pd.read_csv("Python\Project\Dataset\foodhub_order.csv")

C df = pd.read_csv("Python//Project//Dataset//foodhub_order.csv")

D df = pd.read_csv("Python\\Project\\Dataset\\foodhub_order.csv")
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Loading Datasets in Pandas
read_csv - pandas function used to load datasets in CSV format into a pandas dataframe

Syntax: df = pd.read_csv(“file_path/file_name.csv”)

Pandas has to be imported with alias pd - import pandas as pd

maitrayeeb@[Link]
KAP934JM0X
The file name has to be enclosed in quotation marks (single or double)

Above syntax works when the file (dataset) is in the same working directory as the Python
notebook

When the file (dataset) and the Python notebook are not in the same working directory,
the path to the file has to be specified

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Which of the following measures condense the dataset down to one


representative central value?

A Mean, Median, Mode


maitrayeeb@[Link]
KAP934JM0X

B Standard Deviation, Variance, Range

C Correlation Coefficient

D Maximum, Median, Minimum


This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Which of the following measures condense the dataset down to one


representative central value?

A Mean, Median, Mode


maitrayeeb@[Link]
KAP934JM0X

B Standard Deviation, Variance, Range

C Correlation Coefficient

D Maximum, Median, Minimum


This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Common Statistical Measures

Central tendency measures condense the dataset down to one representative central value

Allows us to compare one dataset to another

maitrayeeb@[Link] Mean
Mean Median
Median Mode
Mode
KAP934JM0X
The mean is the arithmetic average The median is the middle score in a The mode is the most frequent
of a set of given numbers. set of given numbers. score in a set of given numbers.

df[‘column_name’].mean( ) df[‘column_name’].median( ) df[‘column_name’].mode( )[0]

The mean can be used to Since the mean is highly affected Mode is the preferred measure
represent the typical value and by the outliers, the median is a
when data is categorical.
therefore serves as a yardstick for better choice for a dataset with
all observations. extreme values

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Consider a dataframe df with two attributes "height" and "weight". Which of


the following methods can be used to check the correlation between these
two variables?

A [Link]()
maitrayeeb@[Link]
KAP934JM0X

B [Link](df)

C [Link](data=df, x='height')

D [Link](df['height'], df['weight'])
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Consider a dataframe df with two attributes "height" and "weight". Which of


the following methods can be used to check the correlation between these
two variables?

A [Link]()
maitrayeeb@[Link]
KAP934JM0X

B [Link](df)

C [Link](data=df, x='height')

D [Link](df['height'], df['weight'])
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Common Statistical Measures
Correlation is a measure of association between two variables

Correlation coefficient is a statistical measure of the strength of the linear relationship


between two variables.

[Link](df['height'],
maitrayeeb@[Link]
[Link]() [Link](df)
df['weight'])
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Common Statistical Measures
Based on direction of change in the value of one variable as the value of the other changes, the
two variables are said to have a positive relationship, negative relationship, or no relationship
at all.

maitrayeeb@[Link]
KAP934JM0X

+ve correlation -ve correlation No correlation

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Consider a dataframe df containing information about CustomerID, Region,


Purchase Amount. which of the following statements is true?

A [Link]()provides information about data types of columns


maitrayeeb@[Link]
KAP934JM0X
df.value_counts('CustomerID') returns a single number
B
representing the total count of the values in the 'CustomerID' column

[Link]() returns the counts, mean, standard deviation, min, max,


C
and quartiles of numeric columns

[Link]('Region')[‘Purchase Amount’].sum() provides the


D
total sum of amount of purchase by different regions
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Consider a dataframe df containing information about CustomerID, Region,


Purchase Amount. which of the following statements is true?

A [Link]()provides information about data types of columns


maitrayeeb@[Link]
KAP934JM0X
df.value_counts('CustomerID') returns a single number
B
representing the total count of the values in the 'CustomerID' column

[Link]() returns the counts, mean, standard deviation, min, max,


C
and quartiles of numeric columns

[Link]('Region')[‘Purchase Amount’].sum() provides the


D
total sum of amount of purchase by different regions
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Pandas

One of the most commonly used Python libraries for data manipulation and analysis

[Link]( ) [Link] [Link]( ) [Link]( )

The [Link]( ) function The [Link]() function


The [Link]( ) function The [Link] returns the
maitrayeeb@[Link] convert the data type of an returns information about
returns the first 5 rows of number of rows and
KAP934JM0X existing column in a the dataframe including the
the dataframe columns of the dataframe
dataframe data types of each column
and memory usage

[Link]( ) [Link]( ) [Link]( ) df.value_counts( )

The [Link]() function The [Link]( ) function


The [Link]() function The df.value_counts( )
returns the statistical info function is used to split the
returns the unique returns a Series containing
like percentile, mean, data into groups
values present in a the counts of unique values.
standard deviation, etc. of
dataframe
the dataframe
This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

According to the jointplot below, where is the highest density of data points?

A Total bill ~(15 – 20) & Tip ~(3 - 4)


maitrayeeb@[Link]
KAP934JM0X

B Total bill ~(5 - 10) & Tip ~(1.5 - 2.5)

C Total bill ~(10 - 20) & Tip ~(1.5 - 2.5)

D Total bill ~(25 - 35) & Tip ~(3 - 4)


This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

According to the jointplot below, where is the highest density of data points?

A Total bill ~(15 – 20) & Tip ~(3 - 4)


maitrayeeb@[Link]
KAP934JM0X

B Total bill ~(5 - 10) & Tip ~(1.5 - 2.5)

C Total bill ~(10 - 20) & Tip ~(1.5 - 2.5)

D Total bill ~(25 - 35) & Tip ~(3 - 4)


This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Significance of Data Visualization

Gives us a better idea of the information stored in data by giving it visual context through
various plots

Allows us to visualize large volumes of data in an understandable and coherent way

maitrayeeb@[Link]
KAP934JM0X
Also enables us to identify relationships and patterns within data

Helps us comprehend the information and draw conclusions and insights

Enables data storytelling to easily create a narrative through graphics and diagrams

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Which of the following the combination of plot and type of data is generally
used for univariate analysis?

A Boxplot - Numerical Data


maitrayeeb@[Link]
KAP934JM0X

B Histogram - Numerical data

C Lineplot - Categorical Data

D Countplot - Categorical Data


This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Python Programming & EDA Quiz

Which of the following the combination of plot and type of data is generally
used for univariate analysis?

A Boxplot - Numerical Data


maitrayeeb@[Link]
KAP934JM0X

B Histogram - Numerical data

C Lineplot - Categorical Data

D Countplot - Categorical Data


This file is meant for personal use by maitrayeeb@[Link] only.
Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Choosing plots for Univariate Analysis
When to use a Histogram

When the data is numeric and you want to see the shape of the data
distribution, determine whether the data is distributed approximately
normally (bell shaped) or not

[Link]( data = , x = ‘ ‘, kde = True )


maitrayeeb@[Link]
KAP934JM0X

When to use Boxplot

When the data is numeric and you want to understand the centre,
spread, and presence of outliers

[Link]( data = , x = ‘ ‘)

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Choosing plots for Univariate Analysis
When to use a Count plot

When the data is categorical and you want to show the counts of
observations in each categorical bin

[Link]( data = , x = ‘ ‘)

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Choosing plots for Bivariate Analysis
When to use a scatter plot

When the data is numeric and you want to determine whether the two
variables are related, and see if it's a positive or negative correlation.

[Link]( data = , x = ‘ ‘, y = ‘ ‘ )

maitrayeeb@[Link]
KAP934JM0X

When to use a line chart

When the data is continuous and you want to see the how the value
of something changes over short and long periods of time.

[Link]( data = , x = ‘ ‘, y = ‘ ‘ )

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Business Context and Objective

The number of restaurants in New York is increasing day by day. Lots of students and busy
professionals rely on those restaurants due to their hectic lifestyles. Online food delivery
service is a great option for them. It provides them with good food from their favorite
restaurants. A food aggregator company FoodHub offers access to multiple restaurants
through a single smartphone app.

maitrayeeb@[Link]
KAP934JM0X

The app allows the restaurants to receive a direct online order from a customer. The app
assigns a delivery person from the company to pick up the order after it is confirmed by the
restaurant. The delivery person then uses the map to reach the restaurant and waits for the
food package.

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Business Context and Objective

Once the food package is handed over to the delivery person, he/she confirms the pick-up in
the app and travels to the customer's location to deliver the food. The delivery person
confirms the drop-off in the app after delivering the food package to the customer. The
customer can rate the order in the app. The food aggregator earns money by collecting a fixed
margin of the delivery order from the restaurants.
maitrayeeb@[Link]
KAP934JM0X

The food aggregator company has stored the data of the different orders made by the
registered customers in their online portal. They want to analyze the data to get a fair idea
about the demand of different restaurants which will help them in enhancing their customer
experience. Suppose you are hired as a Data Scientist in this company and the Data Science
team has shared some of the key questions that need to be answered. Perform the data
analysis to find answers to these questions that will help the company to improve the
business.

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Data Dictionary

Data Data Description

order_id Unique ID of the order

customer_id ID of the customer who ordered the food

restaurant_name
maitrayeeb@[Link] Name of the restaurant
KAP934JM0X
cuisine_type Cuisine ordered by the customer

cost Cost of the order

day_of_the_week Indicates whether the order is placed on a weekday or weekend (The weekday
is from Monday to Friday and the weekend is Saturday and Sunday)

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Data Dictionary

Data Data Description

rating Rating given by the customer out of 5

food_preparation Time (in minutes) taken by the restaurant to prepare the food. This is calculated
_time by taking the difference between the timestamps of the restaurant's order
maitrayeeb@[Link] confirmation and the delivery person's pick-up confirmation.
KAP934JM0X

delivery_time Time (in minutes) taken by the delivery person to deliver the food package. This
is calculated by taking the difference between the timestamps of the delivery
person's pick-up confirmation and drop-off information

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

Step 1: Upload the csv file in the Google Drive

Step 2: Create a new notebook / open an existing notebook

Step 3: Import pandas library into the notebook. The following code can be used for the same
maitrayeeb@[Link]
KAP934JM0X
import pandas as pd

Step 4: Mount Google Drive in the notebook. This can be done via two approaches:

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

Approach 1

Step i: Click on the Files option on the left

Step ii: Select the Mount Drive option


maitrayeeb@[Link]
KAP934JM0X
Step iii: In the pop-up that appears, select Connect to Google Drive option

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

Approach 2

Step i: Run the following command in the notebook

from [Link] import drive


[Link]('/content/drive')
maitrayeeb@[Link]
KAP934JM0X

Step ii: In the pop-up that appears, select Connect to Google Drive option

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

Step 5: Expand the Drive option, and browse to your working directory

Step 6: Right-click on the file and select Copy path

For example, if we want to load the file [Link], which is present in the Colab Notebooks
folder in MyDrive, we would navigate to the folder and right-click on the file to get the file path
maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

Step 7: Create a variable path and set the copied file path as the value of the variable (you can
simply paste the copied file path for this)

Step 8: Pass the path variable as an argument of the pandas read_csv() function to load the file
into a pandas dataframe and store it in a variable
maitrayeeb@[Link]
KAP934JM0X
For example: df = pd.read_csv(path)

Step 9: Call the head() function of the dataframe to check if the data is imported correctly

For example: [Link]()

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Google Colab

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Jupyter Notebook

Step 1: Download the CSV file you want to work with

Step 2: Locate the file in the Local Drive

Step 3: Right-click on the file and click on Properties and copy the file location
maitrayeeb@[Link]
KAP934JM0X
Step 4: Import numpy and pandas

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Jupyter Notebook

Step 5: Paste the path in the variable path and add the filename at the end, as shown below

It is important to replace the single backslash (i.e., \) in the file path with a double
backslash (i.e., \\), a single forward slash (i.e., /), or a double forward slash (i.e., //).

For example: if
the filename is [Link] and the file path is C:\Users\User\Downloads ,
maitrayeeb@[Link]
KAP934JM0X
then the path variable should be defined as one of the following:

path = 'C:\\Users\\User\\Downloads\\[Link]'

path = 'C:/Users/User/Downloads/[Link]'

path = 'C://Users//User//Downloads//[Link]'

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Jupyter Notebook

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Jupyter Notebook

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Jupyter Notebook

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
How to Load Dataset in Jupyter Notebook
Step 6: Call the path variable in the read_csv() function of pandas to load the file into a pandas
dataframe, and store it in a variable

For example: df = pd.read_csv(path)

Step 7: Call the head() function of the dataframe to check if the data is imported correctly
maitrayeeb@[Link]
KAP934JM0X

For example: [Link]()

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Submission Guidelines

Please follow the steps below to attempt the project

Download the dataset and go through the grading rubric

Write necessary code to solve the questions and perform all the tasks as per the grading rubric
maitrayeeb@[Link]
KAP934JM0X
Clearly write down observations, insights, and recommendations for the business problem
based on the analysis performed

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Submission Guidelines

The notebook should be submitted as an HTML file (.html) and as a notebook file (.ipynb)

The conversion can be done via one of the following ways:

Jupyter Notebook:
Google Colab: Use free online tools
maitrayeeb@[Link]
KAP934JM0X
Please make sure that all the sections mentioned in the grading rubric have been covered in
the submission

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
FoodHub - Q/A

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 47
FoodHub - Project FAQs

How to approach 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.

maitrayeeb@[Link]
KAP934JM0X
Step 1: Filter the restaurant's column for those restaurants that do not have a rating as 'Not
given'

Step 2: Convert the rating column created above from object to integer datatype

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 48
FoodHub - Project FAQs
Step 3: Create a dataframe that contains the restaurant names with their rating counts

Step 4: Get all the restaurant names that have a rating count of more than 50

Step 5: find the mean rating of the restaurants by using the group by function

maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 49
FoodHub - Project FAQs

How to approach 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.

maitrayeeb@[Link]
Step 1: Create
KAP934JM0X a function with conditional statements (for each category, 25%, 15% and
0%(else condition) and mention the revenue for each condition.

Step 2: Apply these conditions on the cost_of_the_order column to calculate the revenue, same
the value in a revenue column.

Step 3: Taking summation of the revenue column will give the total revenue.

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action.
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited. 50
Happy Learning !
maitrayeeb@[Link]
KAP934JM0X

This file is meant for personal use by maitrayeeb@[Link] only.


Sharing or publishing the contents in part or full is liable for legal action. 51
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

You might also like