1. Learn
  2. /
  3. Courses
  4. /
  5. Data Privacy and Anonymization in Python

Exercise

Top and bottom coding White House salaries

Top and bottom coding allow us to hide outliers and reduce the risk of identification without reducing data utility.

In this exercise, you're going to use salary data from the US White House from the years of 2019 and 2020. Apply the top and bottom technique for the column salary.

You will start by exploring the salaries, seeing how the bulk of the values lie in the center of the distribution. Based on your exploration, you will select reasonable top and bottom code values.

The DataFrame is loaded as wh2020.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Create a histogram to see the distribution of salaries in the salary column. Use the default bin values.