Generate some data and convert it to MySQL language.
Project description
Mysql and Pandas random data generation
This is an auxiliary package for learning Mysql and Pandas, and the I feel that inserting some test data is too cumbersome to enter manually, so I write a method that generates this data randomly and can automatically write it in Mysql language and save it to a text file. Currently, only insert into generation is supported.
Only Chinese is supported(Mysql).
0.2.1 更多信息通过get_help()与get_demo()查看
pandas的帮助信息:
import DataMakeCN.pd_datamaker as pdk
print(pdk.get_demo()) # 查看如何使用 pandas随机生成的案例
mysql的帮助信息
import DataMakeCN.datamaker as dm
print(dm.get_demo()) # 获取 mysql 相关的案例
print(dm.get_help()) # 获取 mysql 相关的帮助
使用案例(mysql) 1: 实例1,生成单一数据 姓名,性别,年龄,城市
import DataMakeCN.datamaker as dm
one = dm.DataMaker(20, ("姓名", "性别", "年龄", "城市"))
one.get_data()
使用案例(mysql) 2: 示例2,员工信息 姓名,性别,生日,年龄,身份证,部门,手机,100人
import DataMakeCN.datamaker as dm
one = dm.DataMaker(50, ("姓名", "性别", "工号", "分数语文", "分数数学", "分数英语"),
work_head="2024.三班", work_numwidth=2)
one.get_data("insert_into")
使用案例(mysql) 3: 示例3,员工信息 姓名,性别,生日,年龄,身份证,部门,手机,100人
import DataMakeCN.datamaker as dm
one = dm.DataMaker(100, ("姓名", "性别", "生日", "年龄", "身份证", "部门", "手机"))
one.get_data("insert_into")
使用案例(pandas.DataFrame) 4: 实例4,单纯的获取数据,并非写入数据,便于大家做数据分析时的使用
import DataMakeCN.datamaker as dm
one = dm.DataMaker(20, ("姓名", "性别", "年龄", "城市"))
api = one.API()
print(list(api['name']))
使用案例(pandas.DataFrame) 5: 示例5,DataFrame对象,该对象的随机成绩 列名:科目 行名:姓名
from DataMakeCN.pd_datamaker import to_DataFrame_maker
index = ["Tom",
"Bob",
"Jerry",
"Lucy",
"Lily",
"Mike",
"Tony",
"Amber",
"Kevin",
"Peter"]
r = to_DataFrame_maker(n=20, low=80, high=150,
seed=10, write=True,
display='flatten', index=index,
items=('a',))
r2 = to_DataFrame_maker(5,low=9, high=0.)
print(r)
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 mysql_study_datamaker_cn-0.2.2.1.tar.gz.
File metadata
- Download URL: mysql_study_datamaker_cn-0.2.2.1.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9229630fa3ba5ed0364d0358994a201ed14057415bf77ad0d0198b18dd489ca
|
|
| MD5 |
03036e3b7166acbb31940262b16fea66
|
|
| BLAKE2b-256 |
8739c5ef6a3d023a0939e79795a598536ef89de5f98ccceee71a0b2f24e08ae4
|
File details
Details for the file mysql_study_datamaker_cn-0.2.2.1-py3-none-any.whl.
File metadata
- Download URL: mysql_study_datamaker_cn-0.2.2.1-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b13aefc9997c0d09b94bd94f0b4ae23e19eeaa5227c4fb51f9d502014814cf33
|
|
| MD5 |
22a6ecd1add57ee9acf2054cfcc36e5c
|
|
| BLAKE2b-256 |
e1a03ef1cd9aa98b884f595f24834d92685ddef687436e2c431981f9761b6575
|