age stringclasses 6
values | balance float64 -4,997.12 40.5k ⌀ | created_date stringdate 2023-12-27 00:00:00 2025-01-06 00:00:00 | credit_score int64 302 850 | gender stringclasses 2
values | income float64 18.3k 161k | last_login_date stringdate 2024-06-26 00:00:00 2025-01-03 00:00:00 | marital_status stringclasses 5
values | region stringclasses 7
values | transaction_amount float64 3.91 1.83k |
|---|---|---|---|---|---|---|---|---|---|
50 - 60 | 11,848.37 | 2024-01-10 | 738 | F | 100,899.98 | 2024-08-07 | Single | Other | 75.93 |
60 - 70 | 9,391.78 | 2024-03-10 | 308 | M | 47,236.82 | 2024-10-17 | Married | Other | 300.32 |
60 - 70 | 28,376.25 | 2024-02-02 | 520 | F | 37,950.47 | 2024-12-18 | Divorced | Other | 48.69 |
20 - 30 | 19,767.01 | 2024-10-09 | 740 | F | 53,744.23 | 2024-06-30 | Married | Southeast | 187.64 |
60 - 70 | 18,189.11 | 2024-04-21 | 831 | M | 50,646.32 | 2024-09-14 | Single | Other | 111.8 |
20 - 30 | 21,818.3 | 2024-08-01 | 533 | F | 33,080.81 | 2024-09-16 | Married | North | 167.46 |
40 - 50 | 17,489.25 | 2024-04-22 | 784 | M | 19,733.61 | 2024-07-29 | Widowed | South | 250.04 |
20 - 30 | 10,169.66 | 2024-01-02 | 663 | F | 44,024.09 | 2024-08-05 | Married | North | 271.91 |
60 - 70 | 29,989.8 | 2024-06-05 | 495 | M | 109,729.79 | 2024-11-11 | Divorced | Central | 121.15 |
20 - 30 | 17,087.6 | 2024-12-15 | 564 | M | 46,127.84 | 2024-07-09 | Single | Southeast | 121.02 |
70 - 80 | 14,515.93 | 2024-12-13 | 763 | F | 102,723.2 | 2024-09-02 | Married | Southeast | 18.44 |
30 - 40 | 17,999.85 | 2024-04-07 | 627 | F | 37,667.85 | 2024-08-05 | Single | Southeast | 278.76 |
40 - 50 | 18,934.85 | 2024-06-08 | 746 | M | 123,803.99 | 2024-07-24 | Divorced | Central | 11.27 |
40 - 50 | 9,626.93 | 2024-10-30 | 340 | F | 39,378.06 | 2024-11-27 | Widowed | Other | 260.31 |
30 - 40 | 16,711.57 | 2024-06-13 | 435 | F | 29,442.04 | 2024-10-08 | Single | North | 41.62 |
70 - 80 | null | 2024-09-25 | 463 | M | 27,376.7 | 2024-09-18 | Single | Other | 17.37 |
30 - 40 | 7,915.79 | 2024-06-05 | 804 | M | 32,577.36 | 2024-08-20 | Married | Southeast | 695.46 |
60 - 70 | 18,672.41 | 2024-07-27 | 485 | M | 86,802.64 | 2024-11-04 | Widowed | South | 191.6 |
40 - 50 | 12,079.43 | 2024-04-03 | 583 | M | 30,577.71 | 2024-08-16 | Single | South | 451.62 |
30 - 40 | 30,280.03 | 2024-06-17 | 688 | F | 21,127.24 | 2025-01-02 | Married | Southeast | 80.6 |
50 - 60 | -3,149.38 | 2024-07-01 | 837 | F | 67,932.85 | 2024-10-23 | Single | South | 24.56 |
60 - 70 | -1,361.32 | 2024-01-29 | 836 | F | 21,350.22 | 2024-12-04 | Divorced | Other | 206.28 |
70 - 80 | 7,030.94 | 2024-06-19 | 670 | M | 87,491.47 | 2024-07-16 | Married | Other | 218.83 |
60 - 70 | 5,356.99 | 2024-09-25 | 632 | F | 105,392.81 | 2024-12-07 | Single | North | 268.22 |
70 - 80 | 7,882.74 | 2024-07-05 | 358 | M | 19,951.28 | 2024-09-21 | Married | Midlands | 14.94 |
50 - 60 | 5,868.31 | 2024-04-27 | 849 | M | 75,499.84 | 2024-08-11 | Married | West | 284.68 |
70 - 80 | 13,834.28 | 2024-09-20 | 436 | M | 86,180.18 | 2024-10-28 | UNKNOWN | West | 71.08 |
40 - 50 | 19,750.44 | 2024-05-10 | 809 | F | 74,445.3 | 2024-11-23 | Single | Central | 337.73 |
30 - 40 | 21,705.46 | 2024-07-22 | 803 | F | 113,200.39 | 2024-10-15 | Single | Midlands | 46.11 |
60 - 70 | 14,279.48 | 2024-05-31 | 390 | M | 57,671.31 | 2024-09-10 | Married | South | 118.8 |
50 - 60 | 23,575.56 | 2024-12-21 | 719 | M | 64,829.53 | 2024-11-01 | Married | Other | 180.55 |
50 - 60 | 21,156.49 | 2024-06-17 | 454 | M | 34,555.27 | 2025-01-03 | Married | Other | 116.83 |
20 - 30 | 31,951.54 | 2024-05-16 | 542 | M | 18,325.32 | 2024-10-10 | Married | South | 283.5 |
40 - 50 | 12,339.27 | 2024-10-30 | 480 | M | 21,937.23 | 2024-09-12 | Married | Other | 669.34 |
60 - 70 | 11,530.75 | 2024-05-06 | 624 | M | 20,434.42 | 2024-07-24 | Married | South | 57.29 |
60 - 70 | 7,107.29 | 2024-10-29 | 560 | M | 49,080.04 | 2024-09-09 | Married | Southeast | 28.31 |
30 - 40 | 11,059.23 | 2024-08-02 | 470 | M | 53,483.47 | 2024-09-29 | Single | West | 237.72 |
60 - 70 | 20,630.22 | 2024-04-22 | 647 | M | 43,165.87 | 2024-12-27 | Single | South | 300.37 |
50 - 60 | 15,448.06 | 2024-04-14 | 409 | F | 42,822.36 | 2024-08-08 | Single | Other | 49.05 |
70 - 80 | 7,358.6 | 2024-07-27 | 721 | F | 45,961.45 | 2024-11-12 | Married | Other | 4.75 |
70 - 80 | 30,467.37 | 2025-01-05 | 514 | F | 20,220 | 2024-09-05 | Single | Other | 383.18 |
50 - 60 | 5,305.42 | 2024-03-07 | 567 | F | 33,854 | 2024-09-08 | Single | Other | 352.78 |
60 - 70 | 5,719.03 | 2024-09-22 | 594 | F | 33,402.42 | 2024-11-17 | Single | Central | 42.74 |
20 - 30 | 13,592.88 | 2024-11-27 | 430 | M | 39,973.52 | 2024-12-11 | Single | Central | 101.51 |
30 - 40 | -819.46 | 2024-08-01 | 581 | F | 96,081.75 | 2024-09-27 | Widowed | Midlands | 941.16 |
60 - 70 | -1,182.31 | 2024-10-08 | 844 | F | 123,101.09 | 2024-06-28 | Married | North | 32.12 |
40 - 50 | 15,508.06 | 2024-06-11 | 543 | M | 60,428.2 | 2024-10-01 | Single | Other | 403.21 |
20 - 30 | 17,301.58 | 2024-11-09 | 361 | M | 59,764.07 | 2024-10-24 | Married | Southeast | 13.16 |
70 - 80 | 22,809.67 | 2024-01-01 | 385 | F | 20,222.23 | 2024-12-01 | Divorced | Other | 37.9 |
50 - 60 | 29,197.12 | 2024-03-31 | 775 | M | 34,891.26 | 2024-08-14 | UNKNOWN | West | 6.63 |
70 - 80 | 23,018 | 2024-07-15 | 437 | M | 119,959.96 | 2024-07-05 | Divorced | Midlands | 1,272.47 |
50 - 60 | 10,331.09 | 2024-02-29 | 331 | F | 45,033.59 | 2024-08-18 | Single | North | 217.85 |
70 - 80 | 21,006.07 | 2024-07-26 | 490 | F | 43,915.56 | 2024-09-01 | Married | Other | 138.51 |
40 - 50 | 15,730.09 | 2024-07-02 | 515 | F | 113,809.78 | 2024-08-23 | Single | Central | 170.85 |
30 - 40 | 19,491.36 | 2024-01-25 | 719 | F | 65,851.31 | 2024-12-03 | Single | Midlands | 30.62 |
30 - 40 | 15,100.31 | 2024-04-29 | 509 | M | 41,107.83 | 2024-12-27 | Single | Other | 23.73 |
50 - 60 | 17,661.31 | 2024-05-15 | 732 | F | 43,109.88 | 2024-11-28 | Widowed | Other | 51.43 |
30 - 40 | 16,077.16 | 2024-06-26 | 829 | M | 84,921.25 | 2024-10-17 | Divorced | Southeast | 110.18 |
30 - 40 | 12,924.45 | 2024-01-02 | 558 | F | 39,535.59 | 2024-07-23 | Single | Other | 412.62 |
70 - 80 | 11,322.54 | 2024-05-23 | 810 | F | 81,388.58 | 2024-10-12 | Single | Other | 6.41 |
70 - 80 | 7,356.99 | 2024-03-26 | 387 | F | 79,446.75 | 2024-11-03 | Married | Midlands | 126.6 |
50 - 60 | null | 2024-04-16 | 713 | F | 51,875.27 | 2024-08-15 | Married | North | 176.91 |
20 - 30 | 15,108.63 | 2024-09-23 | 348 | M | 123,376.85 | 2024-06-29 | Single | Central | 14.85 |
40 - 50 | 5,442.95 | 2024-03-02 | 415 | M | 44,578.68 | 2024-07-21 | Married | Central | 351.85 |
70 - 80 | 16,676.73 | 2024-04-15 | 505 | M | 32,824.48 | 2024-09-07 | Married | Central | 129 |
60 - 70 | 12,295.95 | 2024-10-30 | 441 | M | 36,684.6 | 2024-12-16 | Single | South | 149.74 |
20 - 30 | 22,646.2 | 2024-09-05 | 325 | M | 20,183.87 | 2024-12-24 | Married | South | 315.61 |
60 - 70 | 9,339.22 | 2024-06-17 | 385 | F | 91,730.72 | 2024-07-08 | Single | Central | 90.86 |
60 - 70 | 16,862.15 | 2024-09-05 | 789 | M | 32,861.48 | 2024-10-08 | Married | South | 388.49 |
50 - 60 | 17,186.06 | 2024-12-06 | 585 | F | 19,843.36 | 2024-09-27 | Single | North | 420.63 |
30 - 40 | 15,852.25 | 2024-05-22 | 390 | F | 37,641.15 | 2024-08-13 | Single | South | 125.98 |
40 - 50 | 11,320.82 | 2024-02-24 | 414 | M | 101,040.15 | 2024-12-28 | Single | Midlands | 83.49 |
20 - 30 | 30,572.8 | 2024-08-21 | 461 | F | 25,068.19 | 2024-10-27 | Single | Other | 562.28 |
40 - 50 | 6,098.72 | 2024-11-12 | 772 | M | 32,014.14 | 2024-09-29 | Married | Other | 13.17 |
50 - 60 | 10,268.25 | 2024-09-29 | 437 | F | 82,078.81 | 2024-07-07 | Married | Other | 197.03 |
20 - 30 | 6,211.8 | 2024-09-22 | 521 | M | 37,036.37 | 2024-08-06 | Single | West | 263.84 |
70 - 80 | 18,816.41 | 2024-04-04 | 715 | F | 89,341.28 | 2024-09-21 | Married | North | 54.63 |
30 - 40 | 27,003.44 | 2024-11-01 | 498 | F | 24,963.6 | 2024-11-18 | Single | Other | 4.74 |
20 - 30 | 13,927.59 | 2024-02-07 | 618 | M | 23,608.04 | 2024-11-14 | Married | Other | 3.93 |
50 - 60 | 14,890.29 | 2024-11-28 | 566 | M | 67,887.55 | 2024-07-09 | Single | Other | 49.98 |
70 - 80 | 29,113.16 | 2024-12-26 | 302 | F | 23,105.69 | 2024-11-23 | Married | Midlands | 78.89 |
70 - 80 | 21,653.15 | 2024-04-13 | 829 | F | 71,489.23 | 2024-07-21 | Single | Other | 163.23 |
60 - 70 | 5,712.45 | 2024-09-15 | 471 | M | 52,149.39 | 2024-07-26 | Divorced | Southeast | 41.73 |
30 - 40 | 6,281.98 | 2024-02-10 | 765 | M | 117,807.69 | 2024-09-03 | Divorced | Other | 198.55 |
30 - 40 | 8,666.25 | 2024-05-10 | 629 | M | 35,961.12 | 2024-08-17 | Single | Other | 293.78 |
20 - 30 | 14,902.15 | 2024-09-21 | 467 | F | 49,035.92 | 2024-11-06 | Single | Southeast | 36.13 |
20 - 30 | 12,705.07 | 2024-10-07 | 532 | M | 54,339.49 | 2024-09-09 | UNKNOWN | Other | 322.88 |
30 - 40 | 19,213.62 | 2024-12-30 | 815 | M | 98,921.16 | 2024-11-21 | Single | West | 250.24 |
70 - 80 | 17,515.3 | 2024-04-13 | 411 | M | 25,929.97 | 2024-07-08 | Single | Central | 84.38 |
30 - 40 | 17,868.3 | 2024-01-04 | 824 | F | 32,606.15 | 2024-11-15 | Divorced | Other | 267.06 |
70 - 80 | 11,043.33 | 2024-01-12 | 694 | M | 35,474.32 | 2024-11-19 | Married | Other | 108.71 |
30 - 40 | 17,994.4 | 2024-04-11 | 537 | F | 55,163.13 | 2024-11-12 | Married | Southeast | 439.64 |
50 - 60 | 17,751.77 | 2024-04-27 | 614 | M | 88,993.02 | 2024-11-17 | Married | Other | 119.84 |
60 - 70 | 18,819.66 | 2024-02-04 | 749 | F | 115,313.63 | 2024-09-14 | Divorced | Central | 57.19 |
70 - 80 | 19,674.17 | 2024-10-09 | 334 | F | 36,274.83 | 2024-08-13 | Single | Other | 304.65 |
20 - 30 | 17,088.19 | 2024-04-18 | 477 | M | 19,792.24 | 2024-12-04 | Single | Other | 232.11 |
30 - 40 | 15,188.58 | 2024-04-28 | 703 | F | 59,286.72 | 2024-09-26 | Divorced | Other | 10.48 |
20 - 30 | 244.22 | 2024-03-22 | 416 | M | 50,645.02 | 2024-07-08 | Single | West | 177.16 |
20 - 30 | 11,037.38 | 2024-12-10 | 698 | M | 75,478.31 | 2024-12-24 | Married | Other | 268.77 |
30 - 40 | 24,017.79 | 2024-09-26 | 332 | F | 78,065.21 | 2024-09-21 | Married | Other | 1,242.48 |
Anonymization Before/After
A small paired tabular dataset showing the same records before and after a 10-step anonymization pipeline. Useful as a teaching fixture for privacy courses, a benchmark for anonymization toolkits, and a sanity-check input for red-team / membership-inference experiments.
Important: the PII in
sample_raw.csvis entirely synthetic. Names follow the patternPerson_001, emails areperson_001@example.com, phone numbers are555-00XX, and "national IDs" are random 9-digit strings. No real individual is represented. The dataset is published precisely so researchers can demonstrate privacy techniques on PII-shaped data without handling real PII.
At a glance
raw |
anonymized |
|
|---|---|---|
| Rows | 500 | 339 |
| Columns | 16 | 10 |
| Direct identifiers | ✅ present (4) | ❌ dropped |
| Fingerprint columns | ✅ present (2) | ❌ dropped |
| Quasi-identifiers | exact values | generalised (bands / top-N / "Other") |
| Numeric fields | exact values | multiplicative noise injected |
| Dates | exact dates | HMAC-perturbed ±7 days |
| k-anonymity (over age/region/gender) | k=1 in many groups | k≥5 (rest suppressed) |
The 161 missing rows in anonymized were suppressed during k-anonymity
enforcement: every combination of (age band, region, gender) appears at
least 5 times in the released data.
What changed, column by column
| Raw column | Action | Anonymized column |
|---|---|---|
full_name |
dropped (direct ID) | - |
email |
dropped (direct ID) | - |
phone_number |
dropped (direct ID) | - |
national_id |
dropped (direct ID) | - |
source_system_code |
dropped (fingerprint) | - |
internal_batch_id |
dropped (fingerprint) | - |
age (int) |
banded into 10-year ranges | age (e.g. "50 - 60") |
region (str) |
rare categories collapsed to "Other" (top-6 kept) |
region |
gender (str) |
passthrough | gender |
marital_status (str) |
passthrough | marital_status |
income (float) |
±5% multiplicative noise, rounded to 2dp | income |
balance (float) |
±3% multiplicative noise, rounded to 2dp | balance |
credit_score (int) |
passthrough | credit_score |
transaction_amount (float) |
passthrough | transaction_amount |
created_date (date) |
HMAC-deterministic ±7-day offset | created_date |
last_login_date (date) |
HMAC-deterministic ±7-day offset | last_login_date |
After all transforms, columns in the anonymized split are sorted alphabetically and rows are deterministically shuffled (seed=42).
How to use
from datasets import load_dataset
raw = load_dataset("t22000t/anonymization-before-after", "raw", split="train")
anon = load_dataset("t22000t/anonymization-before-after", "anonymized", split="train")
print(raw[0])
# {'full_name': 'Person_001', 'email': 'person_001@example.com', ...,
# 'age': 51, 'region': 'Northeast', 'income': 40617.24, ...}
print(anon[0])
# {'age': '50 - 60', 'region': 'Other', 'income': 100899.98, ...}
Or plain pandas:
import pandas as pd
raw = pd.read_csv("hf://datasets/t22000t/anonymization-before-after/sample_raw.csv")
anon = pd.read_csv("hf://datasets/t22000t/anonymization-before-after/sample_anonymized.csv")
Suggested uses
- Teaching privacy concepts. The before/after diff makes k-anonymity, QI generalisation, and direct-ID suppression concrete in a single side-by-side view.
- Benchmarking anonymization toolkits. Re-run a different tool on
rawand compare its output toanonymized(or to your own adversarial baseline). - Red-team / membership-inference fixtures. Train an MIA classifier
to separate
rawfromanonymized; the AUC quantifies how much identifying signal survived the pipeline. - Sanity-checking a synthetic-data generator. Use
rawas the target distribution and compare against the generator's output on the same schema.
How it was produced
sample_raw.csv is generated by
scripts/create_sample_data.py
in the data-anonymization-toolkit
repo (seed=42, deterministic).
sample_anonymized.csv is the output of running the toolkit's full
10-step pipeline on raw with the config
config/example_simple_anonymization.yaml
(profile ml, k_target=5).
Reproduce locally:
git clone https://github.com/timothy22000/data-anonymization-toolkit
cd data-anonymization-toolkit
pip install -e .
python scripts/create_sample_data.py
python scripts/anonymize_data.py \
--input data/sample.csv \
--output data/anonymized.csv \
--config config/example_simple_anonymization.yaml
Limitations and caveats
- Small. 500 rows is enough to demonstrate the pipeline behaviour but not enough for serious statistical evaluation of a generator.
- Synthetic PII. Names, emails, IDs are templated, not realistic. Adversarial fingerprinting attacks that exploit real-world string distributions (e.g. uncommon surnames) won't find anything interesting here. Use a realistic synthetic-PII library (Faker, mimesis) if that matters for your research.
- One profile, one config. Only the
mlprofile (k=5) is provided. Thepublicprofile (k=20, stronger generalisation) would suppress many more rows. - The "Other" category dominates
region. Because the toy generator uses 8 regions but top-N keeps only 6, two regions get collapsed to"Other"in the anonymized split. Real-world QI generalisation is usually more nuanced.
Personal and sensitive information
None. All PII-shaped fields are deterministically generated from row indices. No real individual's data was used to create this dataset.
Citation
If you use this dataset in a paper or tutorial, please cite the toolkit it came from:
@software{data_anonymization_toolkit,
author = {Mun, Timothy},
title = {data-anonymization-toolkit: Config-driven anonymization,
synthetic data, and red-team validation for tabular data},
url = {https://github.com/timothy22000/data-anonymization-toolkit},
year = {2026}
}
License
MIT - see the parent toolkit repo for the full license text.
Related
- 🔒 Privacy Lab Space - interactive anonymization + red-team demo (uses this dataset as the bundled sample)
- 🛡️ Synthetic Data Privacy Audit Space - upload real + synthetic CSVs, get a privacy verdict
- 📦 data-anonymization-toolkit - the underlying Python library
- Downloads last month
- 16