Skip to main content

DataGen

A Python utility for generating synthetic data for various domains including financial, healthcare, and text data. The library provides specialized generators with built-in domain knowledge and patterns.

Features

  • Multiple specialized data generators:
    • Financial data (OHLCV market data)
    • Healthcare data (patient records, medical events)
    • Text data (structured text content)
    • Generic tabular data with customizable schemas
  • Built-in save functionality for all generators
  • Support for various data types including numerical, categorical, datetime, and text
  • Pattern-based generation from example datasets

Installation

pip install -r requirements.txt

Usage

Financial Data Generation

from datagen.financial import OHLCVGenerator

# Create a financial data generator
generator = OHLCVGenerator()

# Generate OHLCV market data
data = generator.generate(
    start_date="2023-01-01",
    end_date="2023-12-31",
    initial_price=100,
    volatility=0.2
)

# Save the generated data to a CSV file
generator.save_to_csv("market_data.csv")

Healthcare Data Generation

from datagen.healthcare import HealthcareDataGenerator

# Create a healthcare data generator
generator = HealthcareDataGenerator()

# Generate patient records
data = generator.generate(num_patients=100)

# Save the generated data
generator.save("patient_records.csv")

Text Data Generation

from datagen.text import TextGenerator

# Create a text data generator
generator = TextGenerator()

# Generate structured text data
data = generator.generate(rows=50)

# Save the generated data
generator.save("text_data.csv")

Generic Data Generation

from datagen import DataGenerator

# Generate data from scratch
generator = DataGenerator()
df = generator.generate(
    schema={
        'name': 'name',
        'age': 'integer[18:80]',
        'email': 'email'
    },
    rows=100
)

# Or generate based on example data
example_df = pd.read_csv('example.csv')
generator = DataGenerator(example_df)
synthetic_df = generator.generate(rows=100)

# Save generated data
generator.save("generated_data.csv")

Data Types and Schemas

The generic data generator supports various data types that can be specified in the schema:

  • Basic types: integer, float, string, boolean
  • Ranges: integer[min:max], float[min:max]
  • Special types: name, email, date, datetime
  • Categories: category[value1,value2,...]

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for datagen-python 0.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 datagen-python 0.1.0
File Size Uploaded
datagen_python-0.1.0.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datagen-python 0.1.0
File Interpreter ABI Platform
datagen_python-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / datagen_python-0.1.0.tar.gz

Download URL datagen_python-0.1.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d81a99aa5aebb204651fc294a7e5852e30e783f0fafca83b28d2a1aa0fdb9c46
BLAKE2b-256 checksum
How to use checksums
9cec8aca959a7c330439cb3d88fd85448900478cbf51954a26162659107f8667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / datagen_python-0.1.0-py3-none-any.whl

Download URL datagen_python-0.1.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68d6fbf44568c35ec00b26e5ea93e5c9818f00abcf145d13a32221a0d497f2a6
BLAKE2b-256 checksum
How to use checksums
4ebe730fe60148cf633b49157def7f7dd7a5e23024b8eb05a367097b0068c283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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