Skip to main content

Data Privacy and Anonymization in Python

Learn to process sensitive information with privacy-preserving techniques.

Start Course for Free
4 Hours16 Videos49 Exercises
3850 XP

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved by learners at thousands of companies

Course Description

Data privacy has never been more important. But how do you balance privacy with the need to gather and share valuable business insights? In this course, you'll learn how to do just that, using the same methods as Google and Amazon—including data generalization and privacy models, like k-Anonymity and differential privacy. In addition to touching on topics such as GDPR, you'll also discover how to build and train machine learning models in Python while protecting users’ sensitive information such as employee and income data. Let’s get started!

  1. 1

    Introduction to Data Privacy


    Get ready to apply anonymization techniques such as data suppression, masking, synthetic data generation, and generalization. In this chapter, you’ll learn how to distinguish between sensitive and non-sensitive personally identifiable information (PII), quasi-identifiers, and the basics of the GDPR. You'll also encounter real-life examples of what can go wrong if you don't follow these best practices.

    Play Chapter Now
    What's private, and why do we care?
    50 xp
    Privacy is power
    50 xp
    Is it sensitive or non-sensitive?
    100 xp
    Suppression of sensitive attributes
    100 xp
    Data masking and data generation with Faker
    50 xp
    Masking sensitive PII
    100 xp
    Removing names with faker
    100 xp
    Anonymizing with data generalization
    50 xp
    Reducing identification risk with generalization
    100 xp
    Data aggregation and data generalization
    50 xp
    Top and bottom coding White House salaries
    100 xp
  2. 2

    More on Privacy-Preserving Techniques

    Discover how to anonymize data by sampling from datasets following the probability distribution of the columns. You’ll then learn how to apply the k-anonymity privacy model to prevent linkage or re-identification attacks and use hierarchies to perform data generalization in categorical variables.

    Play Chapter Now
  3. 3

    Differential Privacy

    Learn about differential privacy, the model used by major technology companies such as Apple, Google, and Uber. In this chapter, you’ll explore data by generating private histograms and computing private averages in data. You’ll also create differentially private machine learning models that allow businesses to increase the utility of their data.

    Play Chapter Now
  4. 4

    Anonymizing and Releasing Datasets

    In this final chapter, you’ll learn how to apply dimensionality reduction methods such as principal component analysis (PCA) to anonymize large multi-column datasets. You’ll then use Faker to generate realistic and consistent datasets, and scikit-learn to create synthetic datasets that follow a normal distribution. Lastly, you’ll tie everything you learned in this course together as you combine multiple techniques to safely release datasets to the public.

    Play Chapter Now


IBM HR Analytics Employee Attrition & PerformanceUS Adult IncomeMall Customers2017-2018 NBA Salaries


Richie CottonJustin Saddlemyer
Rebeca Gonzalez Headshot

Rebeca Gonzalez

Data Engineer

Rebeca is a data engineer and an entrepreneurial spirit. She has worked in companies like Ayesa and is now co-founder of and APTIC, a startup that focuses on helping visually impaired people to see through Artificial Vision. Besides this, she loves animals, brainstorming sessions, and meeting new people. You can follow or contact her on Twitter and LinkedIn.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA