Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Perform the tasks and answer the questions using Python code ( Jupyter notebook ) . Take screenshots of your work and paste them. To

InstructionsPerform the tasks and answer the questions using Python code (Jupyter notebook). Take screenshots of your work and paste them. To start performing each task, import the Numpy and pandas library and give it an appropriate alias name. Find the version of the pandas package on your system.In performing the tasks, consider the sales data and advertising expenses from January to December:Month AdExp SalesJan165000Feb20.714000Mar26.536000Apr30.640000May32.349000Jun29.57000Jul28.352000Aug31.365000Sep32.217000Oct26.45000Nov23.417000Dec16.41000Task 1Create a dictionary of the sales data using Month as index.Task 2Create a pandas series using the sales dictionary created above.i) Print all the months from the series.ii) Print all the sales value from the series.iii) Print the sales for the last 6 months (Jul-Dec).iv) Change the sales for Jun to 11000 in the series object.v) Display all months when sales was above 30000.vi) Find the average sales for the 12 months.vii) There has been additional sale of 2500,4800 and 3900 in the month of Aug, Sep and Oct respectively. Create a series of this additional sales for the mentioned months. Find the total sales across the months considering the additional sales.viii) Display the months with minimum and maximum sales (consider the additional sales given in vii.Task 3Create a numpy array using the original data given above for AdExp and Sales.Task 4Using the numpy array in Task 3, create a dataframe with months as index and the given column names above.i) Select and display the AdExp and Sales values for Mar, Apr and May.ii) Select and display AdExp for Nov.iii) Select and display Sales for Feb.iv) Create a new column "Net_Sales" which is the difference of Sales and AdExp (Sales -AdExp).v) Find the average value of "AdExp", "Sales" and "Net_Sales".vi) Find the sum of Sales for the 12 months.vii) Get the min, max, median, standard deviation, 25 percentile value, 75 percentile value and the average of "AdExp", "Sales" and "Net_Sales" using a single function.viii) Sort the data by Sales in descending order and display.ix) Include the index as a column in the dataframe. Change the column name to "Month". Hint: Use the reset_index() and rename() function.x) Write the data into a csv file "Sale.csv". Exclude the index while writing into the file.

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

ISBN: 0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

3. Are psychopaths anxious?

Answered: 1 week ago