Skip to main content

Metasyn logo

Transparent and privacy-friendly synthetic data generation

Project Status: Active – The project has reached a stable, usable state and is being actively developed. metasyn on pypi open getting started on colab Readthedocs Docker image version DOI DOI badge


Generate synthetic tabular data in a transparent, understandable, and privacy-friendly way. Metasyn makes it possible for owners of sensitive data to create test data, do open science, improve code reproducibility, encourage data reuse, and enhance accessibility of their datasets, without worrying about leaking private information.

With metasyn you can fit a model to an existing dataframe, save it to a transparent and auditable .json file, and synthesize a dataframe that looks a lot like the real one. In contrast to most other synthetic data software, we make the explicit choice to strictly limit the statistical information in our model in order to adhere to the highest privacy standards.

Highlights

  • 👋 Accessible. Metasyn is designed to be easy to use and understand, and we do our best to be welcoming to newcomers and novice users. Let us know if we can improve!
  • ✨ Fully featured. Out of the box, metasyn natively handles a wide range of data types, missing values, categorical data, key columns with unique values, and structured strings such as postcodes or identifiers.
  • 🔎 Transparent. With metasyn you share not only synthetic data, but also the model and settings used to create it through a traceable, auditable metadata format. Everyone can read and understand what the model does; it is crystal clear which information becomes public.
  • 🔐 Private. By default, metasyn does not incorporate multivariate information, meaning less risk of privacy issues such as identity, attribute, or group disclosure. On top of this, we support privacy plugins such as our own disclosure control plugin to further enhance privacy in critically sensitive situations.
  • 🔗 Integrated. We integrate closely with popular, modern tools in the python ecosystem, building on the wonderful polars dataframe library (pandas is supported too), as well as faker to generate localized data for names, emails, and phone numbers, and more.
  • 📦 Extensible. Are you missing features? Do you have a different definition of privacy? Our plugin system allows you (or your organisation) to create their own extension to adjust metasyn to what you need. Or you can contribute directly to the project.

Installation

Metasyn can be installed directly from PyPI using the following command in the terminal:

pip install metasyn

The latest (possibly unstable) development version can be installed directly from GitHub like so:

pip install git+https://github.com/sodascience/metasyn

Usage

demo

To generate synthetic data, metasyn first needs to fit a MetaFrame to the data which can then be used to produce new synthetic rows:

Example input and output

The above image closely matches the Python code:

import polars as pl
from metasyn import MetaFrame, demo_file

# Get the csv file path for built-in demo dataset
csv_path = demo_file("fruit")

# Create a polars dataframe from the csv file.
# It is important to ensure the data types are correct  
# when creating your dataframe, especially categorical data!
df = pl.read_csv(csv_path, schema_overrides={
  "fruits": pl.Categorical, 
  "cars": pl.Categorical
})

# Create a MetaFrame from the DataFrame.
mf = MetaFrame.fit_dataframe(df)

# Generate a new DataFrame with 5 rows from the MetaFrame.
df_synth = mf.synthesize(5)

# This DataFrame can be exported to csv, parquet, excel and more.
df_synth.write_csv("output.csv")

To explore more options and try this out online, take a look at our interactive tutorial:

For more information on how to create dataframes with polars, refer to the Polars documentation. Metasyn also works with pandas dataframes!

Where to go next

  • Try the metasyn-toolbox where you can generate synthetic data using sliders and dropdown menus without any coding at all!
  • To explore more options and try this out online, take a look at our interactive tutorial: or follow our quickstart
  • As a next step to learn more about generating synthetic data with metasyn we recommend to check out the improve your documentation section.
  • To learn about how minimize the privacy risk of synthetic data, we have a privacy guide or have a look at our disclosure control plugin.
  • Want to create programs that build on metasyn? Take a look at our versioned Docker containers and our CLI.

Citation

If you use metasyn, please cite our JOSS paper! This gives credit to the authors and enables us to show the impact of our work. A bibtex entry is below:

@article{
  schram2025metasyn,
  doi = {10.21105/joss.07099},
  url = {https://doi.org/10.21105/joss.07099},
  year = {2025},
  publisher = {The Open Journal},
  volume = {10},
  number = {105},
  pages = {7099},
  author = {Schram, Raoul and Spithorst, Samuel and van Kesteren, Erik-Jan},
  title = {Metasyn: Transparent Generation of Synthetic Tabular Data with Privacy Guarantees},
  journal = {Journal of Open Source Software}
}

Contributing

Metasyn is an open-source project, and we welcome contributions from the community, from bug reports & feature requests to code contributions. Read our contributing guidelines for more information and to get started!

Contact

Metasyn is a project by the ODISSEI Social Data Science (SoDa) team. Do you have questions, suggestions, or remarks on the technical implementation? Create an issue in the issue tracker or feel free to contact Raoul Schram.

SoDa logo

Metadata

Release files for metasyn 3.1.0

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

Source distribution (sdist)

Source distribution for metasyn 3.1.0
File Size Uploaded Provenance Actions
metasyn-3.1.0.tar.gz 3.1 MB Without provenance Details for metasyn-3.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.5 MB

Release files / metasyn-3.1.0.tar.gz

Download URL metasyn-3.1.0.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
4c81603624b7548924bc219c7af50590411f5ed8983cef69ab8c72175f19ea44
BLAKE2b-256 checksum
How to use checksums
28ad4addddea67eac3ae4eaf837d8249483f6fb0ebce6122f5dff4e658af07d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / metasyn-3.1.0-py3-none-any.whl

Download URL metasyn-3.1.0-py3-none-any.whl
Size 395.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a486f3e25b014c4297335d014cf7c3c232004249e014ee6690765e3b9e2e464
BLAKE2b-256 checksum
How to use checksums
2c67328106dc30084fcdbabb513da7c936b9e3f6f6cf6f2eb9a1ec5e07fa6d47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Security for metasyn 3.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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