Question: You want to create a binary variable Salary _ Cat in the data frame df _ Hi , assigning 1 if the player's salary is
You want to create a binary variable SalaryCat in the data frame dfHi assigning if
the player's salary is above the median salary and otherwise. Which of the
following lines of code will do that?
dfHiSalaryCat' dfHiSalaryapplylambda x: if dfHiSalarymean
else
dfHiSalaryapplylambda x: if dfHiSalarymedian else
None of the choices works!
dfHiSalaryCat' dfHiSalaryapplylambda x: if x
dfHiSalarymedian else
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
