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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d81a99aa5aebb204651fc294a7e5852e30e783f0fafca83b28d2a1aa0fdb9c46
|
|
| MD5 |
4823d4807b806059112bb75ed4d72216
|
|
| BLAKE2b-256 |
9cec8aca959a7c330439cb3d88fd85448900478cbf51954a26162659107f8667
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68d6fbf44568c35ec00b26e5ea93e5c9818f00abcf145d13a32221a0d497f2a6
|
|
| MD5 |
8df1c145500088716802718d84379973
|
|
| BLAKE2b-256 |
4ebe730fe60148cf633b49157def7f7dd7a5e23024b8eb05a367097b0068c283
|