跳转到主要内容

一个基于数据包的便捷数据处理框架

项目描述

logo DataFlows

Travis Coveralls PyPI - Python Version Gitter chat

DataFlows是一种简单直观的数据处理流构建方式。

  • 它是为中小型数据处理而构建的——数据可以适合您的硬盘,但太大无法加载到Excel中或直接加载到Python中,也不足以需要启动Hadoop集群...
  • 它是建立在Frictionless Data项目的基础上——这意味着所有这些流程产生的数据都很容易被其他人重用。
  • 它是一种模式,而不是重量级的框架:如果您已经有一系列下载和提取脚本,这将是一个自然的选择

在下面的功能部分中了解更多。

快速入门

通过pip install.安装dataflows

(如果您使用的是最小UNIX操作系统,请先运行sudo apt install build-essential

然后使用命令行界面为任何远程数据文件启动基本处理脚本

# Install from PyPi
$ pip install dataflows

# Inspect a remote CSV file
$ dataflows init https://raw.githubusercontent.com/datahq/dataflows/master/data/academy.csv
Writing processing code into academy_csv.py
Running academy_csv.py
academy:
#     Year           Ceremony  Award                                 Winner  Name                            Film
      (string)      (integer)  (string)                            (string)  (string)                        (string)
----  ----------  -----------  --------------------------------  ----------  ------------------------------  -------------------
1     1927/1928             1  Actor                                         Richard Barthelmess             The Noose
2     1927/1928             1  Actor                                      1  Emil Jannings                   The Last Command
3     1927/1928             1  Actress                                       Louise Dresser                  A Ship Comes In
4     1927/1928             1  Actress                                    1  Janet Gaynor                    7th Heaven
5     1927/1928             1  Actress                                       Gloria Swanson                  Sadie Thompson
6     1927/1928             1  Art Direction                                 Rochus Gliese                   Sunrise
7     1927/1928             1  Art Direction                              1  William Cameron Menzies         The Dove; Tempest
...

# dataflows create a local package of the data and a reusable processing script which you can tinker with
$ tree
.
├── academy_csv
│   ├── academy.csv
│   └── datapackage.json
└── academy_csv.py

1 directory, 3 files

# Resulting 'Data Package' is super easy to use in Python
[adam] ~/code/budgetkey-apps/budgetkey-app-main-page/tmp (master=) $ python
Python 3.6.1 (default, Mar 27 2017, 00:25:54)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datapackage import Package
>>> pkg = Package('academy_csv/datapackage.json')
>>> it = pkg.resources[0].iter(keyed=True)
>>> next(it)
{'Year': '1927/1928', 'Ceremony': 1, 'Award': 'Actor', 'Winner': None, 'Name': 'Richard Barthelmess', 'Film': 'The Noose'}
>>> next(it)
{'Year': '1927/1928', 'Ceremony': 1, 'Award': 'Actor', 'Winner': '1', 'Name': 'Emil Jannings', 'Film': 'The Last Command'}

# You now run `academy_csv.py` to repeat the process
# And obviously modify it to add data modification steps

功能

  • 易于开始,易于扩展
  • 几秒钟内在命令行上设置和运行...
    • dataflows init => flow.py
    • python flow.py
  • 快速验证输入(特别是源)(非零长度,正确结构等。)
  • 支持从源缓存数据,甚至在步骤之间
    • 以便我们可以快速运行和测试(检索是慢的)
  • 立即运行测试:并查看输出...
    • 日志、调试、重新运行
  • 降级为简单Python
  • 约定优于配置
  • 记录异常并/或终止
  • 每个阶段的输入是数据包或数据资源(不是之前的任务)
    • 基于数据包且兼容
  • 处理器可以是一个函数(或一个类),逐行、逐资源或整个包处理
  • 预存在的优秀的贡献库,包括读取器(收集器)、处理器和写入器

了解更多

深入了解教程,以更深入地了解dataflows能做什么。同时查看这个内置处理器列表,它还包括每个处理器的API参考。

项目详情


发布历史 发布通知 | RSS源

下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

dataflows-0.5.5.tar.gz (42.7 kB 查看哈希)

上传于

构建分发

dataflows-0.5.5-py2.py3-none-any.whl (60.5 kB 查看哈希值)

上传于 Python 2 Python 3

由以下支持