My Python Tools
Project description
Prof.Li's Python Tools
道法自然
pip install -U shnu-llq-tools
sample code as follows: ``import numpy as np import pandas as pd
def create_name(name='姓名', rows=40): xing = '赵钱孙李周吴郑王冯陈褚蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏窦章苏潘葛奚范彭郎鲁韦昌马苗方俞任袁柳' ming = "群平风华正茂仁义礼智媛强天霸红和丽平世莉界中华正义伟岸茂盛繁圆一懿贵妃彭习嬴政不韦近荣群智慧睿兴平风清扬自成世民嬴旺品网红丽文天学与翔斌霸学花文教学忠谋书" x = np.random.choice(list(xing), (rows, 1)) m = np.random.choice(list(ming), (rows, 2)) nm = np.hstack((x, m)) df = pd.DataFrame(nm) dff = pd.DataFrame() df[2] = df[2].apply(lambda x: ('', x)[np.random.randint(0, 2)]) dff[name] = df[0] + df[1] + df[2]
return dff[name]
def create_columns(column_list, value_list, rows=40): size = (rows, len(column_list)) if type(value_list[0]) == int and len(value_list) == 2: return pd.DataFrame(np.random.randint(*value_list, size=size), columns=column_list) else: return pd.DataFrame(np.random.choice(value_list, size=size), columns=column_list)
def generate(rows=40): return pd.concat([ create_name('姓名', rows), create_columns(['性别'], ['男', '女'], rows), create_columns(['学校'], ['清华大学', '北京大学', '复旦大学', '上海师大', '上海交大'], rows), create_columns(['班级'], ['计算机科学与技术', '人工智能', '数据科学'], rows), create_columns(['英语', '政治','线代', '概率'], [20, 100], rows), create_columns(['高数', '专业课', '表达能力','面试'], [30, 150], rows)], axis=1)
if name == 'main': print(generate(100)) ``
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
Built Distribution
File details
Details for the file shnu llq tools-1.0.3.tar.gz
.
File metadata
- Download URL: shnu llq tools-1.0.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23cf1403b1e2461fbec9882495565c0ec0e3ebd0656d60ae6a3856895ef1e9cb |
|
MD5 | 4bed51cfe66f02c1685b945b87950f2e |
|
BLAKE2b-256 | 02c9b5b0f36841b037656e25070e70e1bab1dc7ce05c3930dbaff5b16b83467a |
File details
Details for the file shnu_llq_tools-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: shnu_llq_tools-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36a3d0060c7f2cdf3c7b46db77e2861f14226f1367543a15c38e01d18f82f4a8 |
|
MD5 | 3676944cf6e9d6d4aa6de1757127ced5 |
|
BLAKE2b-256 | 11026c08a88d7270ae5f5cb015e50c76a35570953c1909a958be362f3fcab3d1 |