Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 2 - Haggling Electronics with Notebooks Goal: Hands - on experience with file input / output , string manipulation and dictionaries using Jupyter Notebooks.

Assignment 2- Haggling Electronics with Notebooks
Goal: Hands-on experience with file input/output, string manipulation and dictionaries using Jupyter Notebooks.
Problem: Haggling Electronics
transactions_Products_January.csv
Product_ID,Product_Name,Price
P1,2-in-1 Laptop,1500
P2,Game Laptop,2000
P3,Titan Laptop,2100
transactions_Sales_January.csv
transaction_id,date,product_id,quantity,discount
1,2024-01-02,P10,1,0.03
2,2024-01-02,P1,2,0.13
3,2024-01-02,P15,2,0.13
transactions_Returns_January.csv
transaction_id,date
12,2024-01-03
23,2024-01-03
55,2024-01-03
1-Did the discount policy change have an impact?
The store manager did a training for the store staff on how to haggle. They implemented a new stricter policy for providing discounts starting from January 8th. They want to know if this had an impact the offered discounts. Print the average number of transactions without any discount (in percentage) before and after the 8th of January. Print for each product the average discount offered before and after the 8th of January. Each line would have the Product ID on 3 positions, right aligned, followed by the product name and the 2 percentages as illustrated below. The product name should be on 20 positions, right aligned, the percentages should be on 5 positions, 2 after the decimal point and prefixed with 0 and followed by a %. Do not consider the returns as the manager wants to analyze the haggling skills of the staff.
2-Which day of the week brings more business?
Print in a table the average number of sale transactions, and the average amount of sales (after discount) per weekday for the whole month of January. The weekday should be on 9 positions, the count on 3 positions (use round() to round to the closest integer), and the amount on 10 positions, 2 after the decimal point. For amounts, we want the comma as a separator for thousands like $123,345.78. Do not consider the returns as the manager wants to estimate the customers and the sale transactions per weekday. Display two barcharts for the number of transactions per weekday and for the amounts per weekday in the above table. Use the matplotlib bar() method. We want the bars to be blue except red for the weekend. Also, we want the values to be displayed on the bars. For the amounts, we want no digits after the decimal point and a comma as a separator for thousands. The y_axis should be labelled 'Transactions' or 'Dollar amount'.
3-What was the most expensive day in terms of returns?
Knowing that refurbishing and re-shelving a returned item costs 10% of its original labelled price, print the day that cost the most in terms of returns and the total cost of all returns that day. Print the list of the items returned that day (product ID 3 position and product name 20 positions), the number of items (3 positions) and the shelving cost for that returned product (10 positions, 2 after the decimal point, and a comma as a separator for thousands). Use default alignment for each field.
4-What should we order from the suppliers?
The store needs to restock its shelves to the same level they were at the start of the year. Therefore they need to order from their suppliers the same number of items for each product as they sold that month.
Create a text file named "order_supplier_January.txt" to list all the product items and their number using the following format. Note that the file should be sorted by product ID. Each line is for a product with a product ID, product name and the total number of sales for that product. All are separated by the character '#'.
Don't forget to take the returns into account.
Print the same information on the screen. also sorted by product ID .For each product print the product ID (3 positions, right aligned), the product name (20 positions, left aligned), and the number of units we should order (3 positions, right aligned), all separated by a space.
5- Are there unwanted products?
Print a list of products that were never sold. Of course you need to take the returns into account. For each product that was never sold, print the product ID (3 positions, right aligned), the product name (20 positions, left aligned) separated by a space. If there are no products that were never sold, print the product(s) that had the least sales with the number of sales on 3 positions, and print on the same line the dates of sale, enclosed in square brackets and separated by commas.
6-Are discounts and prices correlated?
Print the Pearson correlation coefficient. If this coefficient is close to 1 then there is a strong positive correlation. Luckily the package numpy has a function corrcoef() that returns the correlation matrix, which is a two-dimensional matrix the correlation coefficients. We also want to see the plot of the points fitted with a linear regression line.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

Students also viewed these Databases questions