Personal data is information that can identify an individual directly or when combined with other data. In fine-tuning workflows, it is treated as a privacy and compliance risk requiring removal or masking before use. section 2.4.1
Handle personal data during dataset preparation by:
- Identifying sensitive fields such as client names, account identifiers, and client-level transaction records. section 2.4.1
- Removing or masking identifying values through de-identification before fine-tuning. section 2.4.1
- Using synthetic data when testing pipelines without exposing real individuals. section 2.4.1
- Checking for remaining sensitive information as part of a broader data-readiness checklist. section 2.4
Listing 2.19 Cleaning example
import re
import pandas as pd
data = { #A
"account_id": ["123-456-789", "987-654-321"],
"client_name": ["Alice Johnson", "Bob Smith"],
"transaction": ["USD 1,000", "$2,500.00"],
"notes": [
"Purchase at Grocery Store. CONFIDENTIAL.",
"Wire Transfer. DISCLAIMER: For internal use only."
]
}
df = pd.DataFrame(data)
df["account_id"] = df["account_id"].apply(lambda x: "[ACCOUNT_ID]") #B
df["client_name"] = df["client_name"].apply(lambda x: "[CLIENT]") #B
def normalize_amount(value): #C
cleaned = re.sub(r"[^\d.]", "", value)
return float(cleaned)
df["transaction"] = df["transaction"].apply(normalize_amount)
df["notes"] = df["notes"].apply( #D
lambda x: re.sub(r"DISCLAIMER:.*|CONFIDENTIAL\.", "", x).strip()
)Illustrates masking account identifiers and client names while removing confidentiality and disclaimer artifacts from transaction notes. section 2.4.1












