1. Learn
  2. /
  3. Courses
  4. /
  5. Credit Risk Modeling in Python

Connected

Exercise

Finding outliers with cross tables

Now you need to find and remove outliers you suspect might be in the data. For this exercise, you can use cross tables and aggregate functions.

Have a look at the person_emp_length column. You've used the aggfunc = 'mean' argument to see the average of a numeric column before, but to detect outliers you can use other functions like min and max.

It may not be possible for a person to have an employment length of less than 0 or greater than 60. You can use cross tables to check the data and see if there are any instances of this!

The data set cr_loan has been loaded in the workspace.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Print the cross table of loan_status and person_home_ownership with the max person_emp_length.