Skip to main content

lookalike

Turn a file of real data into one that looks the same but isn't.

lookalike replaces every value in a CSV, JSON, JSON Lines or Parquet file with random fake data of the same type and shape. Each column keeps its number of distinct values and how often each one occurs, so the copy behaves like the original in tests, demos and analysis. Before the output is saved it is checked against the input; if any original value survived, nothing is written.

Example

Input (examples/customers.csv):

customer_id,full_name,email,phone,ssn,city,state,...
CU-1001,Maria Lopez,maria.lopez@acme.com,(703) 281-4410,514-22-9081,Reston,VA,...
CU-1002,James Carter,jcarter@gmail.com,(301) 774-2295,233-71-4406,Bethesda,MD,...
CU-1003,Priya Nair,priya.nair@acme.com,(571) 902-1184,601-35-7720,Reston,VA,...
CU-1001,Maria Lopez,maria.lopez@acme.com,(703) 281-4410,514-22-9081,Reston,VA,...

Output:

customer_id,full_name,email,phone,ssn,city,state,...
ZO-7893,Scott Kirby,hartdaniel298@ikuma.example,(249) 555-4032,000-62-2439,West Jasonborough,DC,...
WO-9217,April Bowman,ojones692@bajecoro.example,(899) 555-1023,000-32-8367,North Josephmouth,CO,...
DU-0967,Vincent Bates,matthew45420@ikuma.example,(940) 555-9546,000-60-1108,West Jasonborough,DC,...
ZO-7893,Scott Kirby,hartdaniel298@ikuma.example,(249) 555-4032,000-62-2439,West Jasonborough,DC,...

Rows 1 and 4 were the same customer and still are. The two acme.com addresses still share a domain. Nothing real is left.

Install

Requires Python 3.10 or newer.

pip install lookalike

For Parquet files, install with the extra:

pip install "lookalike[parquet]"

Use

lookalike inspect   customers.csv                  # 1. see how each column will be treated
lookalike anonymize customers.csv safe.csv         # 2. write the anonymized copy
lookalike verify    customers.csv safe.csv         # 3. optional: re-check later

Common adjustments. ssn, notes, order_total and col7 below stand for column names in your own file; inspect lists them.

lookalike anonymize in.csv out.csv --drop ssn --drop notes     # remove the ssn and notes columns
lookalike anonymize in.csv out.csv --keep order_total          # leave the order_total column as is
lookalike anonymize in.csv out.csv --type col7=name            # tell it the col7 column holds people's names
lookalike anonymize in.csv out.csv --type 'code=regex:[0-9]{2}-[A-Z]{5}'   # fill the code column from your own pattern
lookalike anonymize in.csv out.csv --report report.json        # save the check results

--type takes COLUMN=TYPE. Every column is anonymized whatever its type; the type only decides what the fakes look like. A column of names that inspect shows as text would come out as Kovar Tunib; with --type col7=name it comes out as Scott Kirby. For a format of your own, use regex: followed by a regular expression: [0-9]{2}-[A-Z]{5} gives values such as 66-QNIDO. The full list of types is in Column types.

To reuse the same options, save them under a name and pass --profile (see Profiles):

lookalike profile save customers --drop ssn --type col7=name
lookalike anonymize in.csv out.csv --profile customers

Exit code 0 means the output was written and passed every check.

Before you share the output

lookalike removes the values, not the patterns. Someone looking at the output can still see how many distinct values a column has, how often each occurs, where the blanks are, and the rough range of numbers and dates. That is the point of the tool, but it also means a person who already knows your data could recognise rows by their pattern. Drop columns you do not need, and read what is and is not guaranteed before publishing anything.

Documentation

Guide What it covers
Getting started A first run, step by step, and how to read the results
Command reference Every command and option, selecting columns, exit codes
Column types How types are detected and what each fake looks like
Privacy guarantees What is protected, what stays visible, known limits
Verification The checks that run and the fields of the report
File formats CSV, JSON, JSON Lines and Parquet specifics
Python API Using lookalike from code

Development

uv sync
uv run pytest

Pushing a vX.Y.Z tag publishes to PyPI; see Releasing.

License

Apache License 2.0

Metadata

Release files for lookalike 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lookalike 0.1.2
File Size Uploaded Provenance Actions
lookalike-0.1.2.tar.gz 76.1 kB With provenance Details for lookalike-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lookalike 0.1.2
File Interpreter ABI Platform Actions
lookalike-0.1.2-py3-none-any.whl Python 3 none any Details for lookalike-0.1.2-py3-none-any.whl

Total release size: 111.8 kB

Release files / lookalike-0.1.2.tar.gz

Download URL lookalike-0.1.2.tar.gz
Size 76.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f481e63c39a427196f505f441da6f17183bb4255460104fa1db0167bded85519
BLAKE2b-256 checksum
How to use checksums
f6de7258d5aec82dc657c4dde9fcc8bd3b66f9bdb05dd6e928af51b1c308ff27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / lookalike-0.1.2-py3-none-any.whl

Download URL lookalike-0.1.2-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a27976ae6077de220a3a9ed151d7e3b75a0de0153c2ad0438240c088a2e3752
BLAKE2b-256 checksum
How to use checksums
a4a20b53d9c8e2fd099ea268ddae11dfd13cab61abb5c93c5a67b1ad4a4ab0c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for lookalike 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lookalike-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page