Documentation For Pyhton Project
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.
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
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()
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')
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()
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()
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')
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')