A python lib for data generation
Project description
datamaker-faker
Table of Contents
Installation
pip install datamaker-faker
Features
This package:
- Aims to be a replacement for the
faker
package in Python but NOT a drop-in replacement. - Fast: Generate data quickly at large scales.
- Reproducible: Set a seed to generate the same data over and over.
- Relational: Generate data that is related to each other.
- Extensible: Swop out the data for your own, or bring your own generators.
Usage
import json
from datamaker_faker import Faker
# define your data model
model = {
"first": "first_name",
"last": "last_name",
"sex": "sex",
"city": "city",
"country": "country",
}
# create a new faker instance
faker = Faker(model, seed=9)
# generate some fake data
df = faker.generate(10)
# write the data to a csv file
df.to_csv("datafaker.csv")
# or leverage pandas to convert the data to json
data = df.to_dict("records")
print(json.dumps(data, indent=2))
See generated JSON data
[
{
"first": "sophia",
"last": "weber",
"sex": "female",
"city": "munich",
"country": "germany"
},
{
"first": "aiden",
"last": "brown",
"sex": "male",
"city": "toronto",
"country": "canada"
},
{
"first": "sophia",
"last": "weber",
"sex": "female",
"city": "munich",
"country": "germany"
},
{
"first": "aaradhya",
"last": "singh",
"sex": "female",
"city": "delhi",
"country": "india"
},
{
"first": "liam",
"last": "brown",
"sex": "male",
"city": "chicago",
"country": "united states"
},
{
"first": "daniel",
"last": "kamau",
"sex": "male",
"city": "nairobi",
"country": "kenya"
},
{
"first": "alexander",
"last": "smirnov",
"sex": "male",
"city": "nizhny novgorod",
"country": "russia"
},
{
"first": "johann",
"last": "weber",
"sex": "male",
"city": "munich",
"country": "germany"
},
{
"first": "arjun",
"last": "singh",
"sex": "male",
"city": "delhi",
"country": "india"
},
{
"first": "leonardo",
"last": "ferrari",
"sex": "male",
"city": "naples",
"country": "italy"
}
]
Disclaimer
This package is a work in progress and is not yet ready for production use.
License
datamaker-faker
is distributed under the terms of the MIT license.
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
datamaker_faker-0.0.1.tar.gz
(12.6 kB
view hashes)
Built Distribution
Close
Hashes for datamaker_faker-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4adfd4685db4afa7dae1c847939a80670320742d8a8e549979f3635b4579127 |
|
MD5 | 5d016b987c63e8f6104895ab4f7372e5 |
|
BLAKE2b-256 | 6abe2dfff588c4ec54a2c9e4f84b85c68eaf0e71176c7ebd0b71e546dfc9bb79 |