Exercise: Anonymizing and Encrypting the Data

Data anonymization

Consider a dataset containing credit card transaction details of a bank's customers. The transactions are ATM deposits and withdrawals collected in real time as they happen. When a customer uses their credit card to withdraw or deposit money from an ATM, the transaction details are recorded in the dataset and stored in the bank’s database.

Our job is to anonymize the dataset to protect the customer’s credit card data. The dataset contains the following columns:

  • Customer ID: A unique identifier for each customer

  • Transaction ID: A unique identifier for each transaction

  • Credit Card Number: The credit card number of the customer

  • Type: The type of transactions; deposit or withdrawal

  • Amount: The amount deposited or withdrawn in the transaction

  • Balance: The balance after the transaction

Let’s load a sample dataset into a pandas DataFrame:

Get hands-on with 1200+ tech skills courses.