Skip to main content

Uma biblioteca para gerar dados fictícios para testes

Project description

Mockbinn - Gerador de Dados Fictícios em Python

PyPI Version Python Versions License: MIT

Biblioteca Python para geração de dados fictícios estruturados, perfeita para testes, desenvolvimento e prototipagem.

Instalação

pip install mockbinn

Uso Básico

from mockbinn import Mockbinn
from mockbinn.generators import NameGenerator, EmailGenerator, DateGenerator

# Inicializar o Mockbin
mocker = Mockbinn()

# Configurar um modelo de dados
mocker.set_model("users", 10).set_columns("users", {
    "id": UUIDGenerator,
    "name": NameGenerator,
    "email": EmailGenerator,
    "signup_date": DateGenerator,
    "is_active": BooleanGenerator
})

# Gerar DataFrame
df = mocker.get_df_from_model("users")
print(df)

Exemplos de Uso

# Gerar usuários e pedidos relacionados
users = mocker.model("users", 100).columns("users", {
    "user_id": UUIDGenerator,
    "name": NameGenerator
}).get_df_from_model("users")

orders = mocker.model("orders", 500).columns("orders", {
    "order_id": UUIDGenerator,
    "user_id": lambda: random.choice(users['user_id']),
    "item": ItemGenerator,
    "value": NumberGenerator(10, 1000, decimal=True)
}).get_df_from_model("orders")

Customização de Geradores

# Criando geradores customizados
corporate_email = EmailGenerator(domain="empresa.com.br")
high_value = NumberGenerator(1000, 10000, decimal=True)

mocker.model("employees", 50).columns("employees", {
    "name": NameGenerator,
    "email": corporate_email,
    "salary": high_value
})

Exportando Dados

Você pode exportar os modelos gerados para CSV ou Parquet:

from mockbinn import Mockbinn
from mockbinn.generators import NameGenerator

mocker = Mockbinn()
mocker.model("users", 100).columns("users", {
    "name": NameGenerator
})

# Método alternativo
mocker.export_model(
    model_name="users",
    output_path="data/users.csv",
    format='csv',
    index=False
)

Para usar exportação Parquet, instale as dependências extras:

pip install mockbinn[parquet]
# ou
pip install pyarrow

Licença

Distribuído sob a licença MIT. Veja LICENSE para mais informações.

Contato

Nathan Rodrigo - nathan.lopes@sptech.school

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

mockbinn-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

mockbinn-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file mockbinn-0.1.1.tar.gz.

File metadata

  • Download URL: mockbinn-0.1.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mockbinn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c1ae4b0d10042d6477999385583f87b203ce8f7e9e1ed948f597ab4563d8d526
MD5 66be4efabc2ea569c07e36da3ef2da20
BLAKE2b-256 f155398622aa44a3a6b1fd13118785d2552f7f18f81bd7c72fdfd81837f89e0d

See more details on using hashes here.

File details

Details for the file mockbinn-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mockbinn-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mockbinn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 41c711119cac9d668a9cfc4c25326c429bd6d71981b1a0bcfceeed08759334f6
MD5 2bfdec604fb2121bcc9b6fc3bfc5d823
BLAKE2b-256 c5f5b42e63f45b54968f12e0bc01d74052e14b1b26f6269e643609a59b8d975a

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