0% found this document useful (0 votes)
13 views22 pages

Restaurant Order Analysis with Matplotlib

Uploaded by

r.kiran1909
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)
13 views22 pages

Restaurant Order Analysis with Matplotlib

Uploaded by

r.kiran1909
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

Vanagaram, Chennai - 600077

Informatics Practices – (065)


Project Report
Session: 2025-2026

Name : [Link] Kiran

Grade : XII-A

Reg. No :

Project Title : Analysis Of Restaurant Orders And


Customer Preferences Using
Matplotlib
BONAFIDE CERTIFICATE

Certified to be the Bonafide project work done by

[Link] kiran of class XII of Vedanta Academy, Vanagaram,

Chennai -600077 during the academic year 2025-2026.

Date: Teacher-in-Charge

Submitted for the Senior School Certificate


Examination(SSCE) held in the academic year 2025-2026 at
Vedanta Academy, Chennai - 600077

INTERNAL EXAMINER EXTERNAL EXAMINER


ACKNOWLEGMENT

Apart from the effort of mine, the success of this project


depends largely on the encouragement and guidance of many
others. I take this opportunity to express my gratitude to the
people who have been instrumental in successful completion
of this project.
I express deep sense of gratitude to almighty God for giving
me strength for the successful completion of this project.
I express my heartfelt gratitude to my parents for constant
support and encouragement while carrying out this project.
I express deep sense of gratitude to the luminary The
Principal Ms. Maya. P, who has been continuously motivating
and extending their helping hand to us.
My sincere thanks to Ms. Rajeshwari Swaminathan, the
teacher in-charge, a guide, a mentor, all the above a friend
who critically reviewed my project and helped in solving each
and every problem occurred during the implementation of the
project.
I am overwhelmed to express my thanks to the
Administrative Office staff for providing me the infrastructure
and moral support for carrying out this project in the school.
The guidance and support received from all the members
who contributed and who are contributing to this project was
vital for the success of this project. I am grateful for their
constant support and help.
Analysis Of Restaurant Orders And
Customer Preferences Using
Matplotlib

[Link]
[Link] priyan
TABLE OF CONTENTS

SN DESCRIPTION PAGE NO.


O

1 INTRODUCTION
1

2 HARDWARE & SOFTWARE REQUIREMENTS


2

3 INTRODUCTION TO PYTHON
3

4 INTRODUCTION TO OPEN SOURCE SOFTWARE 4

5 MODULES USED (Pandas & Matplotlib)


5

6 OBJECTIVE OF THE PROJECT


6

7 SOURCE CODE & EXPLANATION


7

8 CSV TABLES AND DATA SCHEMA


9

9 OUTPUT (CHARTS & ANALYSIS)


13

10 BIBLIOGRAPHY 15
INTRODUCTION
In the increasingly competitive hospitality sector, data-driven decision-making is essential for
long-term success. This project, "Analysis of Restaurant Orders and Customer Preferences
using Matplotlib," is designed to provide actionable intelligence by analyzing raw
transactional data from a restaurant.

The core of the project involves leveraging the power of Python and its dedicated data science
libraries, Pandas and Matplotlib. The system ingests data stored in CSV files (representing
orders, menu items, and customers), processes this data to calculate key performance indicators
(KPIs) like item popularity and revenue contribution, and finally presents these findings
through clear, illustrative graphical charts.

The primary aim is to transform complex numerical data into simple visual insights that help
restaurant management:

1. Optimize Inventory: By identifying fast-moving and slow-moving items.

2. Enhance Marketing: By understanding customer preferences and peak activity times.

3. Maximize Revenue: By correlating popular items with their profitability. This project
demonstrates the practical application of Informatics Practices concepts in solving real-
world business problems.
HARDWARE AND SOFTWARE REQUIREMENTS
The project is designed to be executable on standard modern computer systems,
emphasizing compatibility and accessibility, consistent with the open-source nature of the
tools used.

Hardware Requirements:

• Input Devices: Standard Keyboard and Mouse for development and interaction.

• Storage: Hard Disk (HDD/SSD) of 500 GB or more. Adequate storage is necessary


to handle large real-world datasets when the project scales.

• Memory (RAM): 4 GB or higher. Sufficient RAM is crucial for Pandas to


efficiently load, process, and merge large CSV datasets in memory.

• Processor: Intel Core i3 or above. A modern multi-core processor ensures fast


execution of the Python code, especially during data aggregation and chart
rendering.

Software Requirements:

• Operating System (OS): Any widely used OS like Windows (7 or higher), Linux
(e.g., Ubuntu), or macOS.

• Programming Environment: Python 3.8 or higher. The latest versions ensure


compatibility with the required libraries.

• Primary Libraries: Pandas Library (for data manipulation) and Matplotlib


Library (for data visualization).

• Data Handling: Any Spreadsheet software (e.g., Microsoft Excel, LibreOffice


Calc) for handling and creating the initial CSV data files.
INTRODUCTION TO PYTHON

Python is an interpreted, high-level, and general-purpose programming language.


Created by Guido van Rossum and first released in 1991, Python's design
philosophy emphasizes code readability with its notable use of significant
indentation.

In the context of this project, Python's role is critical due to its:

• Simplicity and Readability: Its clear syntax allows for quicker development
and easier maintenance of the source code.

• Vast Ecosystem: The language's powerful community has developed an


enormous collection of libraries, most notably Pandas and Matplotlib, which
are foundational for data science and visualization.

• Independence: Python code can run on various operating systems without


modification, ensuring the project's portability. Its strong capabilities in
handling large datasets and performing complex mathematical and statistical
operations make it the definitive choice for data analysis projects.
INTRODUCTION TO OPEN SOURCE SOFTWARE
Open-source software (OSS) is software that is distributed with its source code,
making it available for users to use, modify, and distribute with its original rights.
This concept is central to the development of modern Data Science tools.

The use of OSS in this project—Python, Pandas, and Matplotlib—provides


several advantages:

• Cost-Effectiveness: It eliminates the need for expensive commercial


licenses, making it accessible for educational and small-business use.

• Reliability and Quality: The code is transparent and constantly peer-


reviewed by a large global community, leading to rapid bug fixes and
continuous improvement.

• Longevity and Support: The large, active community ensures


comprehensive documentation and long-term support, which is vital for
maintaining the project over time. By relying on these robust, community-
driven tools, the project aligns with modern industry standards for data
analysis.
MODULES USED
Python – Pandas

Pandas is a fundamental library for data manipulation, analysis, and cleaning. It


introduces two primary data structures:

1. Series: A one-dimensional labeled array capable of holding any data type.

2. DataFrame: A two-dimensional labeled data structure with columns of


potentially different types, analogous to a spreadsheet or SQL table.

In this project, Pandas is used to:

• Read the [Link], [Link], and [Link] files into


DataFrames.

• Merge DataFrames ([Link]) to combine order details with item prices


and names, creating a consolidated dataset for analysis.

• Perform Group-by operations (groupby()) to aggregate data, calculating


total order counts per item and total revenue generated.

Python – Matplotlib

Matplotlib is the project’s dedicated plotting library. Specifically, the


[Link] module provides a MATLAB-like interface for creating
static, interactive, and animated visualizations.

It enables the project to:

• Create various plot types (Bar Chart, Pie Chart) suitable for categorical
data analysis.

• Customize charts with titles, axis labels ([Link], [Link]),


and grid lines to enhance readability.

• Use features like autopct in the pie chart to automatically display


percentage values, ensuring clarity in revenue contribution analysis. The
visualizations transform numerical outputs into easily interpretable graphical
forms.
OBJECTIVE OF THE PROJECT

The overarching objective is to utilize data visualization techniques to convert


restaurant data into tangible business insights.

The detailed objectives are:

1. To analyze restaurant order patterns by calculating and visualizing the


frequency of orders across all menu items.

2. To identify customer preferences by determining the most (and least) popular


food items.

3. To visualize menu popularity through bar charts to provide an immediate


ranking of demand.

4. To calculate revenue contribution per item and visualize it using a pie chart to
understand which products drive profitability.

5. To help restaurants make data-driven decisions on inventory stock levels,


menu pricing, and marketing promotions based on visualized trends.
SOURCE CODE & EXPLANATION
Project Code (restaurant_analysis.py)

Python

import pandas as pd
import [Link] as plt

# Function to load data from CSV files into Pandas DataFrames


def load_data():
"""Loads orders, menu, and customer data from CSV files."""
try:
orders = pd.read_csv("[Link]")
menu = pd.read_csv("[Link]")
customers = pd.read_csv("[Link]")
print("Data loaded successfully.")
return orders, menu, customers
except FileNotFoundError as e:
print(f"Error: One of the CSV files was not found: {e}")
return None, None, None

# Function to perform analysis and generate visualizations


def visualize_data():
orders, menu, customers = load_data()
if orders is None:
return

# Merge data: Combine order records with item names and prices
merged = [Link](orders, menu, on="ItemID")
print(f"Data merged: {len(merged)} records for analysis.")

# 1. ANALYSIS: Most Ordered Food Items (Popularity)


item_counts = merged['ItemName'].value_counts()

# VISUALIZATION: Popular Items Bar Chart


[Link](figsize=(8,6))
item_counts.plot(kind='bar', color='#FFC300')
[Link]("1. Most Ordered Food Items (Popularity Analysis)")
[Link]("Item Name")
[Link]("Order Count")
[Link](rotation=45, ha='right') # Improve label visibility
[Link](axis='y', linestyle='--', alpha=0.7)
plt.tight_layout()
[Link]()
# 2. ANALYSIS: Revenue Contribution
# Group by item name and sum the 'Price' column (assuming
price is the revenue for that item)
revenue = [Link]('ItemName')['Price'].sum()

# VISUALIZATION: Revenue Contribution Pie Chart


[Link](figsize=(8,8))
# 'autopct' formats the percentage to one decimal place
[Link](kind='pie', autopct='%1.1f%%', startangle=90,
cmap='Set2')
[Link]("2. Revenue Contribution Per Item (Profitability
Analysis)")
[Link]("") # Remove the default 'Price' label on the
side
plt.tight_layout()
[Link]()

if name == " main ":


visualize_data()

Explanation of Key Code Components

1. Data Loading (load_data): Uses pd.read_csv() to import data. The


try...except block ensures the program handles the case where a file might be
missing.

2. Data Merging ([Link]): This is a critical data manipulation step. It joins the
orders and menu DataFrames based on the shared key column, ItemID. This
operation brings the ItemName and Price into the order record, which is necessary
for the analysis.

3. Popularity Analysis (value_counts): The


merged['ItemName'].value_counts() function quickly counts the
occurrences of each unique item name, producing a Pandas Series that forms the basis
for the Bar Chart.

4. Revenue Analysis (groupby().sum()): [Link]('ItemName')


['Price'].sum() groups all records by their ItemName and then calculates the
total sum of the Price for each group, providing the total revenue generated by each
item.
CSV TABLES AND DATA SCHEMA
The project operates on a relational data model supported by three structured CSV files.

1. [Link]

• Purpose: Contains the transactional history.

• Key Columns:

◦ OrderID: Unique identifier for each transaction.


◦ ItemID: Foreign key linking to the [Link] (used for merging).
◦ CustomerID: Foreign key linking to [Link].
◦ OrderTime: Timestamp (useful for future Peak Hours analysis).
2. [Link]

• Purpose: Lists available items and their prices.

• Key Columns:

◦ ItemID: Primary key (unique identifier for a dish).


◦ ItemName: Name of the dish (e.g., 'Burger', 'Pizza').
◦ Price: Selling price of the item.
3. [Link]

• Purpose: Stores customer demographics.

• Key Columns:

◦ CustomerID: Primary key.


◦ CustomerName: Name of the customer.
◦ Age: Age (useful for segmentation).
◦ Location: Customer's area (useful for delivery analysis).
CSV outputs for the three files:

1. [Link]

2. [Link]
3. [Link]
4. merged = [Link](orders, menu, on="ItemID")
OUTPUT CHARTS
OUTPUT ANALYSIS
The system generates two crucial visualizations: a Bar Chart for item popularity
and a Pie Chart for revenue contribution.

1. Most Ordered Food Items (Bar Chart)

Analysis:

This chart directly addresses customer preferences. It ranks menu items by the
absolute number of times they were ordered.

• Key Insight: Burger, Pizza, and Pasta are the most frequently ordered
items (2 orders each).

• Actionable Recommendation: The restaurant must ensure these top three


items are always in stock. Promotions should focus on these popular items
to maximize sales volume. The item Fries (1 order) is ordered less and may
be considered a side-item or a target for an upselling campaign.

2. Revenue Contribution Per Item (Pie Chart)

Analysis:

This chart is essential for profitability analysis. It shows the percentage of total
revenue that each category contributes. Popularity (order count) does not always
translate directly to revenue.

• Key Insight: Pizza (39.2%) generates the highest proportion of revenue,


followed by Pasta (29.4%). Though Burger was equally popular by count,
its lower price results in a lower revenue share (23.5%).

• Actionable Recommendation: The restaurant should focus marketing


efforts on Pizza, as it is the highest-value item. Small price adjustments or
special add-ons for Pizza could yield the biggest return. The difference in
contribution between Pizza and Burger, despite equal popularity, suggests
that Pizza has a higher price point, which is valuable information for pricing
strategy.
BIBLIOGRAPHY

• NCERT – Informatics Practices (Class XII) Textbook and Curriculum.

• Python Documentation: Official language reference for syntax and built-in


functions. [Link]

• Pandas Library Documentation: Comprehensive user guides and API


reference for data manipulation. [Link]

• Matplotlib Library Documentation: Detailed resources for plotting and


visualization customization. [Link]

• Classroom Notes, Worksheets, and Teacher Guidance provided by the


Informatics Practices faculty.

• Online Tutorials and Educational Resources from platforms like


GeeksforGeeks and W3Schools for specific coding solutions.

You might also like