Answered step by step
Verified Expert Solution
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 Haggling Electronics with Notebooks
Goal: Handson experience with file inputoutput string manipulation and dictionaries using Jupyter Notebooks.
Problem: Haggling Electronics
transactionsProductsJanuary.csv
ProductIDProductName,Price
Pin Laptop,
PGame Laptop,
PTitan Laptop,
transactionsSalesJanuary.csv
transactioniddate,productidquantity,discount
P
P
P
transactionsReturnsJanuary.csv
transactioniddate
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 th 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 th of January. Print for each product the average discount offered before and after the th of January. Each line would have the Product ID on positions, right aligned, followed by the product name and the percentages as illustrated below. The product name should be on positions, right aligned, the percentages should be on positions, after the decimal point and prefixed with and followed by a Do not consider the returns as the manager wants to analyze the haggling skills of the staff.
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 positions, the count on positions use round to round to the closest integer and the amount on positions, after the decimal point. For amounts, we want the comma as a separator for thousands like $ 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 yaxis should be labelled 'Transactions' or 'Dollar amount'.
What was the most expensive day in terms of returns?
Knowing that refurbishing and reshelving a returned item costs 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 position and product name positions the number of items positions and the shelving cost for that returned product positions, after the decimal point, and a comma as a separator for thousands Use default alignment for each field.
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 "ordersupplierJanuary.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 positions, right aligned the product name positions, left aligned and the number of units we should order positions, right aligned all separated by a space.
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 positions, right aligned the product name positions, left aligned separated by a space. If there are no products that were never sold, print the products that had the least sales with the number of sales on positions, and print on the same line the dates of sale, enclosed in square brackets and separated by commas.
Are discounts and prices correlated?
Print the Pearson correlation coefficient. If this coefficient is close to then there is a strong positive correlation. Luckily the package numpy has a function corrcoef that returns the correlation matrix, which is a twodimensional 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started