生成pandas数据帧,基于json表模式描述符加载和提取数据。
tableschema-pandas的Python项目详细描述
table schema pandas py
===
schema<;http://specs.frictionlessdata.io/table schema/>;`_描述符。
features
--
-实现``tableschema.storage``接口
这意味着主要的版本可能会包含破坏性的更改。强烈建议在"setup/requirements"文件中指定"package"的版本范围,例如
"package>;=1.0,<;2.0`。
:
$pip install tableschema pandas
示例
~您可以在
`examples<;https://github.com/frictionlessdata/tableschema pandas py/tree/master/examples>;`_
目录。
代码::python
>;>;导入数据包
>;>;数据URL='http://data.okfn.org/data/core/country list/datapackage.json'
>;>;存储=数据包。推送数据包(数据URL,"熊猫")
>;存储.存储桶
["数据存储"]
>;>>类型(存储["数据存储"]
<;类"熊猫.核心.帧.数据帧">;
>;>>;存储["数据"].head()
名称代码
0阿富汗af
1奥兰群岛ax
2阿尔巴尼亚al
3阿尔及利亚dz
4美属萨摩亚as
数据包:
…代码::python
>>>datapackage.pull_datapackage('/tmp/datapackage.json','country_list','pandas',tables={
…'数据:存储["数据"],
…})
存储
本自述文件之外的所有内容都是私有的
API,可以在不通知任何新版本的情况下进行更改。
~`_
接口(请参阅链接上的完整文档):
方式:
…代码::python
>;>;从tableschema_pandas import storage
>;>;storage=storage()
您可以使用"storage.create"方法在存储中定义新的
数据帧:
。代码::python
>;>storage.create('数据',{
…'主关键字":"id",
…"字段":[
…{'name':'id','type':'integer'},
…{'name':'comment','type':'string'},
…]
…})
>;>storage.bucket
['data']
>;>storage['data'].shape
(0,0)
代码::python
>;>storage.write('data',[(1,'a'),(2,'b')])
>;>storage['data']
id comment
1 a
2 b
来自外部数据文件的数据帧。如您所见,后续的
写操作只是在exi上附加新数据叮咬者:
…代码::python
>;>import tabulator
>;>tabulator.stream('data/comments.csv',headers=1)作为流:
…storage.write('data',stream)
>https://github.com/okfn/coding standards>;`_.
建议开始的方法是创建并激活项目
虚拟环境。
将包和开发依赖项安装到活动
环境:
:
:
$make install
使用linting和coverage运行测试:
。代码:bash
$make test
在这个
阶段,它已经
安装到您的环境中,可以与文档中描述的更多
细粒度控制单独使用-
https://pylama.readthedocs.io/en/latest/
例如,按错误类型对结果排序:
。代码::bash
$pylama--sort<;path>;
对于在``tox.ini``中配置的测试``tox``使用。
它已经安装到您的环境中,并且可以与文档中描述的更细粒度控制一起单独使用
-https://testrun.org/tox/latest/
在python 2环境中,
增加了详细信息。
`--``之后的所有位置参数和选项都将传递给
``py.test`:
代码::bash
tox-e py27--v tests/<;path>;
此软件包仅在tox
环境中可用。此处仅描述了中断和最重要的更改。所有已发布版本的完整
变更日志和文档可以在
格式良好的"提交
历史记录"中找到;https://github.com/frictionlessdata/tableschema pandas py/commits/master>;` `.
~~~~~
初始驱动程序实现。
| travis图像::https://img.shields.io/travis/friectionlessdata/tableschema pandas py/master.svg
:目标:https://travis ci.org/friectionlessdata/tableschema pandas py
。|工作服图片:http://img.shields.io/covertalls/frictionlessdata/tableschema-pandas-py.svg?branch=master
:目标:https://coveralls.io/r/frictionlessdata/tableschema-pandas-py?分支=主
…| pypi图像::https://img.shields.io/pypi/v/tableschema pandas.svg
:目标:https://pypi.python.org/pypi/tableschema pandas
…| gitter图像::https://img.shields.io/gitter/room/friectionlessdata/chat.svg
:目标:https://gitter.im/friectionlessdata/chat
。|存储图像::https://i.imgur.com/rqgrxqp.png
===
features
--
-实现``tableschema.storage``接口
这意味着主要的版本可能会包含破坏性的更改。强烈建议在"setup/requirements"文件中指定"package"的版本范围,例如
"package>;=1.0,<;2.0`。
:
$pip install tableschema pandas
示例
~您可以在
`examples<;https://github.com/frictionlessdata/tableschema pandas py/tree/master/examples>;`_
目录。
代码::python
>;>;导入数据包
>;>;数据URL='http://data.okfn.org/data/core/country list/datapackage.json'
>;>;存储=数据包。推送数据包(数据URL,"熊猫")
>;存储.存储桶
["数据存储"]
>;>>类型(存储["数据存储"]
<;类"熊猫.核心.帧.数据帧">;
>;>>;存储["数据"].head()
名称代码
0阿富汗af
1奥兰群岛ax
2阿尔巴尼亚al
3阿尔及利亚dz
4美属萨摩亚as
数据包:
…代码::python
>>>datapackage.pull_datapackage('/tmp/datapackage.json','country_list','pandas',tables={
…'数据:存储["数据"],
…})
存储
本自述文件之外的所有内容都是私有的
API,可以在不通知任何新版本的情况下进行更改。
接口(请参阅链接上的完整文档):
方式:
…代码::python
>;>;从tableschema_pandas import storage
>;>;storage=storage()
您可以使用"storage.create"方法在存储中定义新的
数据帧:
。代码::python
>;>storage.create('数据',{
…'主关键字":"id",
…"字段":[
…{'name':'id','type':'integer'},
…{'name':'comment','type':'string'},
…]
…})
>;>storage.bucket
['data']
>;>storage['data'].shape
(0,0)
代码::python
>;>storage.write('data',[(1,'a'),(2,'b')])
>;>storage['data']
id comment
1 a
2 b
来自外部数据文件的数据帧。如您所见,后续的
写操作只是在exi上附加新数据叮咬者:
…代码::python
>;>import tabulator
>;>tabulator.stream('data/comments.csv',headers=1)作为流:
…storage.write('data',stream)
>https://github.com/okfn/coding standards>;`_.
建议开始的方法是创建并激活项目
虚拟环境。
将包和开发依赖项安装到活动
环境:
:
:
$make install
使用linting和coverage运行测试:
。代码:bash
$make test
在这个
阶段,它已经
安装到您的环境中,可以与文档中描述的更多
细粒度控制单独使用-
https://pylama.readthedocs.io/en/latest/
例如,按错误类型对结果排序:
。代码::bash
$pylama--sort<;path>;
对于在``tox.ini``中配置的测试``tox``使用。
它已经安装到您的环境中,并且可以与文档中描述的更细粒度控制一起单独使用
-https://testrun.org/tox/latest/
在python 2环境中,
增加了详细信息。
`--``之后的所有位置参数和选项都将传递给
``py.test`:
代码::bash
tox-e py27--v tests/<;path>;
此软件包仅在tox
环境中可用。此处仅描述了中断和最重要的更改。所有已发布版本的完整
变更日志和文档可以在
格式良好的"提交
历史记录"中找到;https://github.com/frictionlessdata/tableschema pandas py/commits/master>;` `.
初始驱动程序实现。
| travis图像::https://img.shields.io/travis/friectionlessdata/tableschema pandas py/master.svg
:目标:https://travis ci.org/friectionlessdata/tableschema pandas py
。|工作服图片:http://img.shields.io/covertalls/frictionlessdata/tableschema-pandas-py.svg?branch=master
:目标:https://coveralls.io/r/frictionlessdata/tableschema-pandas-py?分支=主
…| pypi图像::https://img.shields.io/pypi/v/tableschema pandas.svg
:目标:https://pypi.python.org/pypi/tableschema pandas
…| gitter图像::https://img.shields.io/gitter/room/friectionlessdata/chat.svg
:目标:https://gitter.im/friectionlessdata/chat
。|存储图像::https://i.imgur.com/rqgrxqp.png