Skip to main content

De-identify CSV

Pass a CSV, get a de-identified CSV. Same method handles .xlsx and .xls.

customers.csv
name,email,phone,notes
Jane Smith,jane.smith@example.com,(415) 555-0123,Requested a follow-up call.
Alex Chen,alex.chen@example.com,(212) 555-0198,Interested in enterprise support.
from custodian_labs import GuardianLayer

result = GuardianLayer().deidentify_file(
"customers.csv",
masking_type="transform",
pii_entities=["PERSON", "EMAIL_ADDRESS", "PHONE_NUMBER"],
)
with open(result.filename or "deid_customers.csv", "wb") as f:
f.write(result.content)

Swap redact for ***** output. Omit pii_entities (or ["ALL"]) to process everything.

See also​

File De-identification · Guardian Layer client