Get startedGet started for free

Removing names with faker

In this exercise, you will work with the 2018 NBA Salaries dataset. If this data weren't public, there would be a high risk of a re-identification attack. For example, since there is only one "Aaron Brooks" playing in the NBA, it could be possible to know other sensitive information like his exact salary per year. By removing personal names from the dataset, you can avoid potential damage to the people in it.

The .name() method will generate random names, including some female names. Besides doing this, you will also create names of one gender only.

The DataFrame has been loaded as nba.

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.

# Import the Faker class
____

# Initialize the generator
____
Edit and Run Code