Feather R语言和Python交互式硬盘存储格式
2016-04-07 20:12
696 查看
本文更新地址 :/article/9717740.html
本文参考:http://blog.rstudio.org/2016/03/29/feather/
R语言大神Hadley的有一力作:Feather。
Feature是一种文件格式,支持R语言和Python的交互式存储,速度更快。目前支持R语言的data.frame和Python pandas 的DataFrame。
Feather收到了Apache arrow 项目的支持,Apache Arrow是Apache基金会下一个全新的开源项目,同时也是顶级项目。它的目的是作为一个跨平台的数据层来加快大数据分析项目的运行速度。
不依赖语言,支持python和R语言,同时也可以被其他语言读取
高性能读写
Python
测试笔记本:
macbook pro
2.7GHz 双核 Intel Core i5 处理器
8GB 1866MHz LPDDR3 内存
SSD硬盘
Python
Feature速度快,但是还处在开发阶段,官方认为暂时不适合长期存储数据,而且不能保证不同版本的兼容性。 但是可以用于R和Python的交互,也是相当相当棒了。
本文参考:http://blog.rstudio.org/2016/03/29/feather/
R语言大神Hadley的有一力作:Feather。
Feature是一种文件格式,支持R语言和Python的交互式存储,速度更快。目前支持R语言的data.frame和Python pandas 的DataFrame。
Feather收到了Apache arrow 项目的支持,Apache Arrow是Apache基金会下一个全新的开源项目,同时也是顶级项目。它的目的是作为一个跨平台的数据层来加快大数据分析项目的运行速度。
Feature特征
轻量简单不依赖语言,支持python和R语言,同时也可以被其他语言读取
高性能读写
代码简单
Rlibrary(feather) path <- "my_data.feather" write_feather(df, path) df <- read_feather(path)
Python
import feather path = 'my_data.feather' feather.write_dataframe(df, path) df = feather.read_dataframe(path)
速度快
R语言测试测试笔记本:
macbook pro
2.7GHz 双核 Intel Core i5 处理器
8GB 1866MHz LPDDR3 内存
SSD硬盘
library(feather) x <- runif(1e7) x[sample(1e7, 1e6)] <- NA # 10% NAs df <- as.data.frame(replicate(10, x)) # 内存占用 format(object.size(df), 'MB') #[1] "762.9 Mb" # feature与load比较 system.time(write_feather(df, 'test.feather')) # user system elapsed # 0.520 1.314 3.435 system.time(read_feather('test.feather')) # user system elapsed # 0.730 0.507 1.305 system.time(save(df, file='test.rda')) # user system elapsed # 118.406 1.579 126.134 system.time(load('test.rda')) # user system elapsed # 4.388 0.439 4.857 # 文件大小比较 # test.feather 812.5M # test.rda 499.2M
安装
Rdevtools::install_github("wesm/feather/R")
Python
pip install feather-format
Feature速度快,但是还处在开发阶段,官方认为暂时不适合长期存储数据,而且不能保证不同版本的兼容性。 但是可以用于R和Python的交互,也是相当相当棒了。
相关文章推荐
- 简单Python3爬虫程序(1)简单架构:队列、集合、正则
- Python的getattr(),setattr(),delattr(),hasattr()
- Django学习笔记 开发环境搭建
- python reduce函数
- CNKI小爬虫(Python)
- ubuntu下Eclipse创建Django项目
- PyQt QString转成python stirng
- python fabric实现远程操作和部署
- 代码迁移攻略:在Java工程中调用Python代码
- Python xrange与range
- python-摩尔斯电码查询器
- python GUI学习——Tkinter
- python 学习笔记十二 html基础(进阶篇)
- Implementing a Neural Network from Scratch in Python – An Introduction
- python学习5
- 常见的python错误类型和继承关系
- Leetcode 23. Merge k Sorted Lists(python)
- A Byte of Python 笔记(12)python 标准库:sys、os,更多内容
- Python ctypes 模块
- python学习笔记--socket