Expert: deep learning and AI · Ethics, privacy and careers · topic 59 of 62 · 35 min
Privacy and data protection
Explanation
Why privacy matters to data people
Data scientists handle phone numbers, addresses, purchase histories, health records and location trails. Misuse or a leak can cause fraud, harassment, discrimination and loss of trust, and can bring heavy penalties for the organisation. Good privacy practice is not a legal afterthought; it shapes which data you collect, how you store it and what you build.
Key ideas
- Personal data: information about an individual who can be identified from it, directly (name, phone, Aadhaar number) or indirectly (a combination of pin code, birth date and gender).
- Consent and purpose limitation: use data only for the specific purpose people were told about and agreed to.
- Data minimisation: collect and keep only what you need. If age group is enough, do not store date of birth.
- Storage limitation: delete data when the purpose is over.
- Security: encryption, access controls, and logs of who accessed what.
Anonymisation versus pseudonymisation
Pseudonymisation replaces direct identifiers with codes, such as replacing customer IDs with salted hashes. Whoever holds the key or the mapping can link the data back, so it is still personal data, but it reduces risk in daily analysis. Anonymisation means nobody can reasonably re-identify the person. It is much harder than it sounds: famous studies have shown that a combination like pin code, birth date and gender can single out most people in a population. Releasing "anonymised" data without testing this is risky.
import hashlib
def pseudonymise(customer_id, salt):
return hashlib.sha256((salt + customer_id).encode()).hexdigest()[:16]
print(pseudonymise("CUST001", "s3cret"))k-anonymity and differential privacy
k-anonymity is a simple check: every combination of quasi-identifiers (columns that could identify someone together, like age band, pin code and gender) must be shared by at least k people. If one row is the only "female, 70–80, pin 403001", she can be identified. Differential privacy is a stronger, mathematical approach: it adds carefully measured random noise to results so that no single person's data noticeably changes them. It is used by some census bureaus and large tech companies for published statistics.
The law in India: the DPDP Act, 2023
The Digital Personal Data Protection Act, 2023 governs the processing of digital personal data in India. Its key roles: the data principal (the person the data is about) and the data fiduciary (the organisation that decides why and how data is processed). Fiduciaries generally need valid consent given through a clear notice, must use data only for the stated purpose, must protect it, must report breaches, and must let people access, correct and erase their data. A Data Protection Board handles complaints and can impose large penalties. The government notified the detailed DPDP Rules in 2025 with a phased timeline; check the current rules and official guidance before relying on any detail.
If you handle data of people in the European Union, the GDPR may apply too. Sector rules also matter: for example, RBI rules for payment data and specific rules for health data. Aadhaar numbers have their own legal protections; never store or display full Aadhaar numbers without a clear legal basis, and mask them (show only the last four digits) where display is needed.
Common mistakes
- Copying full production customer data to a laptop "for analysis". Use masked or minimal extracts.
- Calling data anonymous after removing names only.
- Pasting personal data into AI tools that are not approved for it.
- Keeping data forever "in case it is useful".
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
Privacy and data protection · 1/7
Personal data is any information about a person who can be identified, directly or indirectly.
Prefer a video by a teacher? Find free videos on “data privacy anonymization k-anonymity DPDP Act 2023 explained” on YouTube ↗
In real life: A health-app analytics project
A fitness app wants to study which features help users stay active. The data team receives pseudonymised user codes instead of phone numbers, age bands instead of birth dates, and city instead of exact location. Before publishing a blog post with charts, they check that every reported group has at least 50 users and remove smaller groups. Raw data access is limited to two engineers, logged, and deleted after the study.
Practice (0/3 done)
Write pseudonymise(customer_id, salt) that returns the first 16 hex characters of hashlib.sha256((salt + customer_id).encode()).hexdigest().
Write k_anonymity(rows, quasi) where rows is a list of dicts and quasi is a list of column names (quasi-identifiers). Group rows by the tuple of their quasi-identifier values and return the size of the SMALLEST group (that is the k the data satisfies). Return 0 for no rows.
You are asked to share a dataset of 2 lakh bank customers with an outside analytics vendor to study credit-card usage. Write a privacy review: what to remove or transform, what to check before sharing, and what agreements and controls should be in place.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- Career paths: analyst, scientist, ML engineer, AI engineerEthics, privacy and careers · same module
- Portfolio, projects and interviewsEthics, privacy and careers · same module
- India: the DPDP Act 2023 and CERT-In directionsCyber Security: from zero to SOC analyst · Governance, risk and compliance
- GDPR overviewCyber Security: from zero to SOC analyst · Governance, risk and compliance
- The law in India: IT Act 2000, sections 43 and 66Ethical Hacking and Penetration Testing (legal labs) · Rules first: ethics, law and permission
- India: CERT-In and the legal landscapeEthical Hacking and Penetration Testing (legal labs) · Bug bounties, disclosure and careers
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
Customer names are replaced with random codes, and the bank keeps the code-to-name table. The data is…
Answer: Pseudonymised, and still personal data
Re-identification is possible with the mapping.
What is data minimisation?
Answer: Collecting and keeping only the data you need for the purpose
Less data means less risk.
Under India's DPDP Act, 2023, who is the "data principal"?
Answer: The individual the personal data is about
The data fiduciary is the organisation; the principal is the person.
A released table has one row that is the only "female, 70–80, pin 403001". Which check would have caught this?
Answer: k-anonymity
A group of size 1 means that person can be singled out.
What does differential privacy do?
Answer: Adds measured random noise to results so no single person noticeably changes them
It gives a mathematical privacy guarantee for published statistics.
Under the DPDP Act, who is a child?Related
Answer: Under 18
A child is a person under 18; verifiable parental consent is needed.
The GDPR "controller" is closest to which DPDP role?Related
Which newer Indian law governs handling of personal data?Related
Answer: The Digital Personal Data Protection Act, 2023
The DPDP Act, 2023 governs personal data; testers must handle any personal data they see very carefully.
Any personal data you encounter should be…Related
Answer: Handled carefully and not kept or shared (DPDP Act)
The DPDP Act requires careful handling of personal data.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 3 more topics in “Ethics, privacy and careers” before its exam: Career paths: analyst, scientist, ML engineer, AI engineer, Portfolio, projects and interviews, Capstone: an end-to-end project.
- Module 12 exam: Ethics, privacy and careers · 12 questions · 20 min, without help. 5 topics of this module still to finish first.
- 62 topics left in the course before the final exam.