Skip to main content

A Python utility for generating synthetic data for various domains

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datagen_python-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datagen_python-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file datagen_python-0.1.0.tar.gz.

File metadata

  • Download URL: datagen_python-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for datagen_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d81a99aa5aebb204651fc294a7e5852e30e783f0fafca83b28d2a1aa0fdb9c46
MD5 4823d4807b806059112bb75ed4d72216
BLAKE2b-256 9cec8aca959a7c330439cb3d88fd85448900478cbf51954a26162659107f8667

See more details on using hashes here.

File details

Details for the file datagen_python-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: datagen_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for datagen_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68d6fbf44568c35ec00b26e5ea93e5c9818f00abcf145d13a32221a0d497f2a6
MD5 8df1c145500088716802718d84379973
BLAKE2b-256 4ebe730fe60148cf633b49157def7f7dd7a5e23024b8eb05a367097b0068c283

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page