FastPII Docs
Guides

Removing Data

Remove detected PII entirely from text.

Removing Data

Use remove() to delete detected PII values entirely from the text. Unlike other transformation modes, removal leaves no placeholder at all.

Basic removal

from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.cz import CzechPack

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(CzechPack())

text = "Email: jan.novak@example.cz, RČ: 8001011238"
result = engine.remove(text)
print(result)

Output:

Email: , RČ:

Using TransformationEngine directly

from fastpii.core.transform import TransformationEngine, RemoveStrategy

result = engine.detect(text)
removed = TransformationEngine.apply(result, RemoveStrategy())
print(removed)

When to use removal

Removal is best when:

  • You want no trace of PII in the output text
  • Storing text in databases where even type labels are sensitive
  • Preparing text for systems that should never see any PII residue

Note that removal can affect text readability and grammar. If you need to preserve text structure, consider redaction or masking instead.

On this page