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

Instructions
Perform 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 in this assignment, consider the sales data and advertising expenses from January to December:
Month AdExp Sales
Jan
1
6
5
0
0
0
Feb
2
0
.
7
1
4
0
0
0
Mar
2
6
.
5
3
6
0
0
0
Apr
3
0
.
6
4
0
0
0
0
May
3
2
.
3
4
9
0
0
0
Jun
2
9
.
5
7
0
0
0
Jul
2
8
.
3
5
2
0
0
0
Aug
3
1
.
3
6
5
0
0
0
Sep
3
2
.
2
1
7
0
0
0
Oct
2
6
.
4
5
0
0
0
Nov
2
3
.
4
1
7
0
0
0
Dec
1
6
.
4
1
0
0
0
Task
1
Create a dictionary of the sales data using
Month
as index.
Task
2
Create 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
1
1
0
0
0
in the series object.
v
)
Display all months when sales was above
3
0
0
0
0
.
vi
)
Find the average sales for the
1
2
months.
vii
)
There has been additional sale of
2
5
0
0
,
4
8
0
0
and
3
9
0
0
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
3
Create a numpy array using the original data given above for AdExp and Sales.
Task
4
Using 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
1
2
months.
vii
)
Get the min, max, median, standard deviation,
2
5
percentile value,
7
5
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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

=+how the customer arrived at their site.

Answered: 1 week ago

Question

Explain the multicultural organization development (MCOD) process.

Answered: 1 week ago