使用Arrow管理数据

在之前的数据挖掘:是时候更新一下TCGA的数据了推文中,保存TCGA的数据就是使用Arrow格式,因为占空间小,读写速度快,多语言支持(我主要使用的3种语言都支持)

Format

https://arrow.apache.org

Apache Arrow defines a language-independent columnar memory format for flat and hierarchical data, organized for efficient analytic operations on modern hardware like CPUs and GPUs. The Arrow memory format also supports zero-copy reads for lightning-fast data access without serialization overhead.

Language Supported

Arrow's libraries implement the format and provide building blocks for a range of use cases, including high performance analytics. Many popular projects use Arrow to ship columnar data efficiently or as the basis for analytic engines.

Libraries are available for C, C++, C#, Go, Java, JavaScript, Julia, MATLAB, Python, R, Ruby, and Rust.

Ecosystem

Apache Arrow is software created by and for the developer community. We are dedicated to open, kind communication and consensus decisionmaking. Our committers come from a range of organizations and backgrounds, and we welcome all to participate with us.

R

install.packages("arrow")

library(arrow)

write iris to iris.arrow and compressed by zstd

arrow::write_ipc_file(iris,'iris.arrow', compression = "zstd",compression_level=1)

read iris.arrow as DataFrame

iris=arrow::read_ipc_file('iris.arrow')

python

conda install -y pandas pyarrow

import pandas as pd

read iris.arrow as DataFrame

iris=pd.read_feather('iris.arrow')

write iris to iris.arrow and compressed by zstd

iris.to_feather('iris.arrow',compression='zstd', compression_level=1)

Julia

using Pkg

Pkg.add(["Arrow","DataFrames"])

using Arrow, DataFrames

read iris.arrow as DataFrame

iris = Arrow.Table("iris.arrow") |> DataFrame

write iris to iris.arrow, using 8 threads and compressed by zstd

Arrow.write("iris.arrow",iris,compress=:zstd,ntasks=8)

相关推荐
小瓦码J码7 分钟前
PostgreSQL pg_stat_statements 性能分析利器(二)全表扫描导致物理IO爆炸
数据库·postgresql
2501_9454235413 分钟前
如何为开源Python项目做贡献?
jvm·数据库·python
2401_8845632415 分钟前
使用Flask快速搭建轻量级Web应用
jvm·数据库·python
清风徐来QCQ15 分钟前
Redis以及如何在springboot中使用
数据库·redis·缓存
编程饭碗25 分钟前
【Mysql日期字段】
数据库·mysql
Thomas.Sir25 分钟前
精通 MySQL 面试题
数据结构·数据库·mysql
上海云盾-小余31 分钟前
应用层漏洞实战防护:SQL 注入、XSS、文件上传漏洞一站式加固方案
数据库·sql·xss
鸽芷咕32 分钟前
从语法兼容到语义一致:深度解析金仓如何“无感”承接MySQL复杂业务
数据库·mysql
新缸中之脑33 分钟前
AI智能体评估指南
数据库·人工智能·oracle
add45a38 分钟前
Python类型提示(Type Hints)详解
jvm·数据库·python