I tried using mimesis

mimesis Test data creation library. It's an unfamiliar word, but it seems to have a meaning like "mimicry". Faker is also famous, but it seems to be faster than faker.

install

pip install mimesis

usage Basically, test data is created from the provider. There are quite a few types of providers, such as those related to people (Personal), those related to addresses (Address), and those related to food (Food).

Basic usage

from mimesis import Personal

#Create an instance by specifying the locale for the provider
personal = Personal(locale='ja')

#Get data from your provider
print(personal.full_name(gender='male'))

Use Generic

Generic can be used when it is troublesome to specify the locale for each provider and create an instance when using multiple providers.

from mimesis import Generic

generic = Generic(locale='ja')

#Create test data from your provider through Generic
print(generic.personal.full_name())

Use Schema

If you use Schema, test data will be created as an object of list. Specify the format of the data you want in the Schema.load method and use it.

from mimesis.schema import Schema

schema = Schema('ja')
data = schema.load(schema={
    "name": "personal.full_name",
    "email": "personal.email"
}).create(itertions=2)

result


[{'name': 'Takagi Akiba', 'email': '[email protected]'}, {'name': 'Chiharu Ichikawa', 'email': '[email protected]'}]

Summary

In addition, since there are various providers, is it sufficient as a function to create ordinary test data? However, the documentation on the original site is poor, so if you want to use the full functionality, you may have to read the code. Text provider Text.sentence, for some reason, it is interesting to return historical sentences ...

Recommended Posts

I tried using mimesis
I tried using argparse
I tried using anytree
I tried using aiomysql
I tried using Summpy
I tried using coturn
I tried using Pipenv
I tried using matplotlib
I tried using "Anvil".
I tried using Hubot
I tried using ESPCN
I tried using openpyxl
I tried using Ipython
I tried using PyCaret
I tried using cron
I tried using ngrok
I tried using face_recognition
I tried using Jupyter
I tried using PyCaret
I tried using Heapq
I tried using doctest
I tried using folium
I tried using jinja2
I tried using folium
I tried using time-window
[I tried using Pythonista 3] Introduction
I tried using easydict (memo).
I tried face recognition using Face ++
I tried using Random Forest
I tried using BigQuery ML
I tried using Amazon Glacier
I tried using git inspector
[Python] I tried using OpenPose
I tried using magenta / TensorFlow
I tried using AWS Chalice
I tried using Slack emojinator
I tried using Rotrics Dex Arm # 2
I tried using Rotrics Dex Arm
I tried using GrabCut of OpenCV
I tried using Thonny (Python / IDE)
I tried server-client communication using tmux
I tried reinforcement learning using PyBrain
I tried deep learning using Theano
Somehow I tried using jupyter notebook
[Kaggle] I tried undersampling using imbalanced-learn
I tried shooting Kamehameha using OpenPose
I tried using the checkio API
[Python] I tried using YOLO v3
I tried asynchronous processing using asyncio
I tried scraping
I tried PyQ
I tried AutoKeras
I tried papermill
I tried django-slack
I tried Django
I tried spleeter
I tried cgo
I tried using Amazon SQS with django-celery
I tried using Azure Speech to Text.
I tried using Twitter api and Line api
I tried playing a ○ ✕ game using TensorFlow