gen_data简介
介绍
gen_data是一个方便的工具,支持生成csv测试数据文件。
它可以用来生成一个非常大的数据文件用于测试目的。
usage: gen_data [-h] -r rows [-c columns] [-t titles] csvfilegenerate csv file with specfied number of rows, and column types.positional arguments: csvfileoptions: -h, --help show this help message and exit -r rows, --rows rows number of rows -c columns, --columns columns list of colume type, in this format: "t t t:n ..." where t is type (number), n is column length. -t titles, --titles titles list of column titleslist of supported types: bool=1 int=2 string=3 float=4 date=5 datetime=6
如何设置?
# clone the repogit clone git@github.com:patfinder/gen_data.git# move to the tool source folder. then enter below command to setup the tool.# after this, gen_data will become a script command that you can execute directly.$ pip install -e .# show info of installed script$ pip show gen_dataname: gen-dataversion: 0.0.1summary: a convinient tool for generating big test data.home-page: https://github.com/patfinder/gen_data/author: le vuong nguyenauthor-email: vuong.se@gmail.comlicense: unknownlocation: ~/myrepos/gen_datarequires: required-by:
用法
# Show Help for the command$ gen_data --help# Run sample command to generate csv with 5 rows# and columns of (int, string, string with length of 20, int) and column titles$ gen_data f1.csv -r 5 -c"1,3,3:20,2" -t"is_active,name,job_desc,score"# Sample output of above command is f1.csv with below content$ cat f1.csv id,is_active,name,job_desc,score1,False,Louis Martinez,Really tonight we.,5592,True,Larry Williams,Moment word camera.,8453,True,Brandon Williams,Wear your consumer.,6774,False,Chelsea Zamora,Identify itself let.,3845,True,Jonathan Collier MD,Offer popular.,502