0% found this document useful (0 votes)
47 views3 pages

Documentation For Pyhton Project

This document provides documentation for a Python project that analyzes sales data. The project reads data from a CSV file, displays basic information about the data, and allows the user to retrieve specific records or generate visualizations. The computer program was developed using Tkinter for the user interface. Functions were created to get records by ID, city, region, or customer name from the CSV file using Pandas. Matplotlib was used to generate graphs from the data. The design focuses on a simple user interface with buttons to execute the required functionalities of retrieving records and generating graphs.

Uploaded by

Mark Ngugi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views3 pages

Documentation For Pyhton Project

This document provides documentation for a Python project that analyzes sales data. The project reads data from a CSV file, displays basic information about the data, and allows the user to retrieve specific records or generate visualizations. The computer program was developed using Tkinter for the user interface. Functions were created to get records by ID, city, region, or customer name from the CSV file using Pandas. Matplotlib was used to generate graphs from the data. The design focuses on a simple user interface with buttons to execute the required functionalities of retrieving records and generating graphs.

Uploaded by

Mark Ngugi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

DOCUMENTATION FOR PYHTON PROJECT

Cover Page
Assignment
Monitoring sales is an essential activity for any business organisation and working
with sales data is a common activity in data science. You will work with a sample
data set that is provided to you in the form of a CSV file. The data file, sales.csv,
contains the following data:
Column Description T You are required to design and develop a computer program to meet
the
following functional requirements:
- The computer program should read the data from the provided file.
- The computer program should display some basic information about the data read
from the file e.g., the total number of records
- The computer program should allow a user to do the following:
- Retrieve a specific record by its record id specified by the user
- Retrieve the records for a specific city specified by the user
- Retrieve the records for a group of orders specified by the user
- Retrieve the top 3 products for a specific region
- Produce suitable and interesting visualisations (plots or graphs) for the
data.

In addition to your computer program, you should also produce a summary of no


more than 1000 words discussing the design and implementation of your solution.
The discussion should focus on explaining how you have achieved each
functionality with suitable technical details.

Documentation

My project focuses on addressing the main concerns of the assignment by giving a very
simple user interface which was developed via tkinter.
For the landing page I created a page with buttons that execute functions required by the
user which were
Get Records by Id
Get Records by City
Get Records by Region
Get Records by the Customer Name
Resources
The first step in the project was to get the csv file from the folder.
I imported the following python libraries to help my work be rather easy and fast to
implement
import csv
import tkinter
from tkinter import Tk, Toplevel, ttk, Text
from tkinter.ttk import *
from doctest import master
from logging import root
from tkinter import *

import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import tkinter.messagebox

CSV library was used to handle csv files


Tkinter library was used to handle the User Interface
Pandas was used to help in querying the data in the csv file easily
Matplotlib library was used to generate graphs and plot them in the User Interface

APPROACH
First: I created a window that launched and had four buttons
The frame of the window was (700 by 700)
I created 5 functions in my python file that were executed by clicking buttons on the main
screen.
1.The first button when clicked generated a function called getrecordbyid which used pandas
to transverse the csv file get the record with the exact ID
def findRecordById():
rId = recordId.get()

print(data.loc[data['Customer Name'] == rId])

text_box = Text(
newWindow,
height=12,
width=90,
)
text_box.pack(expand=True)
text_box.insert('end', data.loc[data['Record Id'] == rId])
text_box.config(state='disabled')

After getting the data I output it in a text box in the UI

2.The first button when clicked generated a function called getrecordbycity which used
pandas to transverse the csv file get the record with the city name

def findRecordByCity():
rId = recordId.get()

print(data.loc[data['Record ID'] == rId])


text_box = Text(
newWindow,
height=12,
width=90,
)
text_box.pack(expand=True)
text_box.insert('end', data.loc[data['City'] == rId])
text_box.config(state='disabled')

After getting the data I output it in a text box in the UI

3..The first button when clicked generated a function called getrecordbyUser which used
pandas to transverse the csv file get the record with the city name

def findRecordByUsr():
rId = recordId.get()

print(data.loc[data['Record ID'] == rId])

text_box = Text(
newWindow,
height=12,
width=90,
)
text_box.pack(expand=True)
text_box.insert('end', data.loc[data['CustomerName'] == rId])
text_box.config(state='disabled')

4..The fourth button when clicked generated a function called generateGraph

def Graph_Generator():
# get random dta to visualize normal distribution data
df = data.DataFrame(data,columns=['Country','State'])

plt.plot(df)
plt.savefig("mygraph.png")
])
text_box.config(state='disabled')

You might also like