Select Page

MSA 80 Georgia State University Python Jupyter Coding with Excel

Question Description

Problem 1

Code a function load_employees that loads the employees table from the path where the file Employees.xls is in your computer and sets the

index of the DataFrame to the EmployeeID. The function should return a table with the EmployeeID as the index and the remaining 25 columns.

Arguments:

  • a DataFrame: Employee Table

Returns:

  • a DataFrame with index of ‘EmployeeID’

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

Number of rows

Number of columns

Head of 10 index

Record of employ with ID=999

Problem 2

Define a function get FullName which takes the employees table from your first function in #1 and a single employee ID as arguments, and returns a string with the full name of the employee in the format “LAST, FIRST MIDDLE”. If the given ID does not belong to any employee return the string “UNKNOWN” (in all caps) If no middle name is given only return “LAST, FIRST”. Make sure there are not trailing spaces! If only the middle initial is given the return the full name in the format “LAST, FIRST M”.

Arguments:

  • df (DataFrame): Employee Table
  • empid (int): Employee ID

Returns:

  • String with full name

### After you finish defining your function, get full name for employee id 259

### After you finish defining your function, get full name for employee id 274, 999, 102, but do not call the function one by one.

Print them as:

274, “Jiang, Stephen Y”

999, “Smith, Chadwick nan”

102, “Mu, Zheng W”

Problem 3

Define a function isSales that takes the job title of an employee as string as an argument and return either True if the job title indicates this person works in sales, and False otherwise.

Argument:

  • jobtitle (str)

Returns:

  • True or False

### After defining your function, check if these job tiles are sales job:’Chief Data Scientist’, ‘Sales Manager’, ‘Vice President of Sales’.

If it is a sales job, print the job title + ‘is part of the Sales Department.’; if not, print the job title + ‘belongs to a different department.’

Problem 4

Define a function filterSales with 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 the isSales function from the previous problem.

Arguments:

  • employees (DataFrame)

Returns:

  • DataFrame with only people from the Sales Department

###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

Problem 5

Define a function managementCounts which produces a Series of how many employees report to a manager. The Series is indexed by the ManagerID, the count should be performed on the unique EmployeeID. The resulting Series should be order by the number of employees in descending order.

Arguments:

  • employees (DataFrame)

Returns:

  • Series of counts (int), indexed by ManagerID

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."

Order Solution Now