Get startedGet started for free

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.

This exercise is part of the course

Data Privacy and Anonymization in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Plot a histogram of salaries
____
plt.show()
Edit and Run Code