一个基于数据包的便捷数据处理框架
项目描述
DataFlows
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-0.5.5.tar.gz (42.7 kB 查看哈希)
构建分发
dataflows-0.5.5-py2.py3-none-any.whl (60.5 kB 查看哈希值)
关闭
dataflows-0.5.5.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 401ed924ce56875a434f85ab1956ea8ff22f935c02877759a41f4bec2d42f682 |
|
MD5 | 59fb9c44506f86015b969c0e1ce244ca |
|
BLAKE2b-256 | 66b977473354f017186817c9be060a1617685f33f0f7cf4235a51c89be658e92 |
关闭
dataflows-0.5.5-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 421ea43b3496e0c62ecaa28d273709e1e54c8ec597ce33b7abbc9c7607e8c60c |
|
MD5 | 323332f72c9a72b31990da382b799a3d |
|
BLAKE2b-256 | 7ba610ce6f728a4c38b5008582814e39c00f113bb2b1ff554674c546b06bc828 |