Question: Link to dataset used: https://drive.google.com/uc?export=download&id=1Un5_dBGBoATPuc_U5Fbou40lD8klme1o Problem 4 Define a functionfilterSaleswith the employee tables as an argument, that returns a new table of the same column_names

Link to dataset used:

https://drive.google.com/uc?export=download&id=1Un5_dBGBoATPuc_U5Fbou40lD8klme1o

Problem 4

Define a functionfilterSaleswith the employee tables as an argument, that returns a new table of the same column_names and row_names containing only row of sales people. You should use theisSalesfunction from the previous problem.

Arguments:

  • employees (DataFrame)

Returns:

  • DataFrame with only people from the Sales Department

Hints:

for loops in DataFrame

  • step 1 loop through the rows
  • pick out job title, then call function isSales
  • if true:
  • store in the new DF

make it better

  • apply -- for loop on DF & PD.Series
  • map -- for loop on PD.Series
  • applymap -- for loop on elements of DF & PD.Series -- much less used because it is VERY slow

After you define the fuction, call the function and print:

Number of row

Number of columns

Head of 10 index

Record of sales employee with ID=280

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!