Skip to main content

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

Python Logo

安装(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

dataito-1.0.1.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

dataito-1.0.1-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page