Question: question 4 :Objective: Compute new variables / column Create a function called compute _ profit _ per _ dollar _ sold that receives as an
question :Objective: Compute new variablescolumn
Create a function called computeprofitperdollarsold that receives as an argument a pandas dataframe. It should add a new column named profitperdollarsold which should be computed as the ratio between values in column Profit and values in column Sales. It should return the dataframe with the new column do not change the column order and leave the new column at the end of the dataframe
Example of usage:
newdf computeprofitperdollarsolddf
df is a pandas dataframe that has the columns "Profit" and "Sales"
newdf as the same information as df plus a column "profitperdollarsold"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
