Python data input (i), transform (t), output (o), a line of code to read / convert a variety of formats of data files
Project description
DataITO
安装(install)
- 安装开发版(Install development version)
py -m pip install --index-url https://test.pypi.org/simple/ --no-deps dataito
- 安装稳定版( Install stable version )
pip install dataito
使用手册 (中文版)
Python数据输入(Input)、转换(transform)、输出(output),一行代码读取/转换多种格式的数据文件
dataito仅有三个函数,分别是read()、transform()、save(),具体参数及调用方式如下:
格式
-
目前支持的读取格式
- txt
- xlsx
- csv
- json(仅支持结构化数据)
-
目前支持的转换格式
- dataframe (pandas)
- array (numpy)
- list
-
目前支持的保存格式
- xlsx(目前仅支持保存为xlsx,在考虑是否要增加自定义格式保存功能)
调用方式
-
read( )
read(filepath)
注:只能读取支持的文件格式(建议filepath之前加个
r
,具体看example) -
transform( )
transform(data,'parameter')
parameter中填写为需要转换的目标数据类型,其与type(data)获取的数据类型的关系如下:
type type(data) dataframe/pandas <class 'pandas.core.frame.DataFrame'> array/numpy <class 'numpy.ndarray'> list <class 'list'> >>> data= dataito.transform(data,'dataframe') >>> type(data) <class 'pandas.core.frame.DataFrame'> >>> data= dataito.transform(data,'array') >>> type(data) <class 'numpy.ndarray'> >>> data= dataito.transform(data,'list') >>> type(data) <class 'list'>
-
save( )
save(filepath)
(建议filepath之前加个
r
,具体看example) -
example
import dataito filepath = r'data/data.xlsx' #读取支持格式的数据文件 data = dataito.read(filepath) #调用函数读取(读取其他支持的格式也是这个函数) data= dataito.transform(data,'dataframe') #数据格式转换为想要的格式(转换为其他支持的格式也是这个) dataito.save(data,r'D:\data\data.xlsx') #保存在data文件夹(默认文件名为data)
User manual (English version)
format
Python data input (i), transform (t), output (o), a line of code to read / convert a variety of formats of data files
-
Currently supported read formats
- txt
- xlsx
- csv
- json (only supports structured data)
-
Currently supported conversion formats
- dataframe
- array (numpy)
- list
-
Currently supported save formats
- xlsx ( it only supports saving as xlsx. We are considering whether to add the function of saving in custom format.)
Call mode
-
read( )
read(filepath)
Note: only the supported file formats can be read (it is recommended to add
r
before filepath, see example for details) -
transform( )
transform(data,'parameter')
parameter is the target data type to be converted, and its relationship with the data type obtained by type (data) is as follows:
type type(data) dataframe/pandas <class 'pandas.core.frame.DataFrame'> array/numpy <class 'numpy.ndarray'> list <class 'list'> >>> data= dataito.transform(data,'dataframe') >>> type(data) <class 'pandas.core.frame.DataFrame'> >>> data= dataito.transform(data,'array') >>> type(data) <class 'numpy.ndarray'> >>> data= dataito.transform(data,'list') >>> type(data) <class 'list'>
-
save( )
save(filepath)
(it is recommended to add
r
before filepath, see example for details) -
example
import dataito filepath = r'data/data.xlsx' #Read data files in supported formats data = dataito.read(filepath) #Call the function to read (read other supported formats as well as this function) data= dataito.transform(data,'dataframe') #Convert the data format to the desired format (and other supported formats) dataito.save(data,r'D:\data\data.xlsx') #Save in the data folder (the default file name is data). If the path is not written, the file is saved in the root directory
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 dataito-1.0.2.tar.gz
.
File metadata
- Download URL: dataito-1.0.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fb93119039f6053df5ce8ed8a833dba56ff5fd48739713a5146cf569d072a81 |
|
MD5 | 5832711e7a5dfea179afb64787c6f544 |
|
BLAKE2b-256 | 1a2d1d3f5d1169006105bb061fcd65004a0a8f76cbc55bdc6cf241bbb20baa0b |
File details
Details for the file dataito-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: dataito-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54adba36ddbee2984f1e0f5052f41143b83c567e5ffe213568177b59b664571b |
|
MD5 | 5436f225a5a3bfd048da47cde2089199 |
|
BLAKE2b-256 | a68bc2ab3d605322072331885d0c4a4c78155d5508963ccd0e240440ba1bb3a6 |