You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Python Pandas读取.arrow(Apache Arrow/Feather V2格式)文件?

读取Apache Arrow格式文件的方法

要读取.arrow格式文件,你可以借助pyarrow库实现,下面是两种常用方案:

方案一:先读取为pyarrow.Table,再转为pandas.DataFrame

  1. 先安装依赖库:
pip install pyarrow
  1. 读取Arrow文件为pyarrow.Table:
import pyarrow as pa

# 打开并读取整个Arrow文件
with pa.ipc.open_file("target_file.arrow") as reader:
    arrow_table = reader.read_all()
  1. 将pyarrow.Table转为pandas.DataFrame:
import pandas as pd

df = arrow_table.to_pandas()

方案二:直接用pandas读取(借助pyarrow引擎)

pandas的read_feather函数支持读取Arrow格式文件(二者格式高度兼容),只需指定engine="pyarrow":

import pandas as pd

df = pd.read_feather("target_file.arrow", engine="pyarrow")

内容的提问来源于stack exchange,提问作者user2138149

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 07:18:09