问题
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. I installed pyarrow this way:
pip install pyarrow
回答1:
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 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.
来源:https://stackoverflow.com/questions/52656972/how-can-i-open-a-snappy-parquet-file-in-python