如何在python中打开.snappy.parquet文件? [英] How can I open a .snappy.parquet file in python?

查看:458
本文介绍了如何在python中打开.snappy.parquet文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在python 3.5中打开.snappy.parquet文件?到目前为止,我使用了以下代码:

How can I open a .snappy.parquet file in python 3.5? So far, I used this code:

import numpy
import pyarrow

filename = "/Users/T/Desktop/data.snappy.parquet" 
df = pyarrow.parquet.read_table(filename).to_pandas()

但是,它给出了此错误:

But, it gives this error:

AttributeError: module 'pyarrow' has no attribute 'compat'

P.S.我以这种方式安装了pyarrow:

P.S. I installed pyarrow this way:

pip install pyarrow

推荐答案

错误AttributeError: module 'pyarrow' has no attribute 'compat'有点令人误解.要在pyarrow.Table实例上执行to_pandas()函数,您需要安装熊猫.以上错误是缺少要求的征兆.

The error AttributeError: module 'pyarrow' has no attribute 'compat' is sadly a bit misleading. To execute the to_pandas() function on a pyarrow.Table instance you need pandas installed. The above error is a sympton of the missing requirement.

pandas不是pyarrow的硬性要求,因为它的大多数功能仅可用于Python内置组件和NumPy.因此,包含熊猫的pyarrow用户可以使用它,而无需预先安装熊猫.

pandas is a not a hard requirement of pyarrow as most of its functionality is usable with just Python built-ins and NumPy. Thus users of pyarrow which include pandas can work with it without needing to have pandas pre-installed.

这篇关于如何在python中打开.snappy.parquet文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆