Skip to main content

A python lib for data generation

Project description

datamaker-faker

Hatch project Ruff License: MIT


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


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 details)

Uploaded Source

Built Distribution

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

datamaker_faker-0.0.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file datamaker_faker-0.0.1.tar.gz.

File metadata

  • Download URL: datamaker_faker-0.0.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for datamaker_faker-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1cb41471afa47694848dda77af3ba3abe3dedc7da96ca87f0e3f40a72f5d8297
MD5 17eeffca752a8ccf2ba00ed9f5021a3c
BLAKE2b-256 aa84bc2b78bb633f908010100b27116fe0e3f313fd67a247cc078bee43af1ad9

See more details on using hashes here.

File details

Details for the file datamaker_faker-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for datamaker_faker-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4adfd4685db4afa7dae1c847939a80670320742d8a8e549979f3635b4579127
MD5 5d016b987c63e8f6104895ab4f7372e5
BLAKE2b-256 6abe2dfff588c4ec54a2c9e4f84b85c68eaf0e71176c7ebd0b71e546dfc9bb79

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