简体   繁体   English

如何使用 Pandas 读取镶木地板文件

[英]How to read parquet file using Pandas

I am trying to read a parquet file using Python 3.6.我正在尝试使用 Python 3.6 读取镶木地板文件。

import pandas as pd


df = pd.read_parquet('smalldata.parquet')



df.head()

However, this is generating an error that module pandas has no attribute read_parquet.但是,这会生成一个错误,即模块 pandas 没有属性 read_parquet。 What dependencies should I cater in order to solve this problem?为了解决这个问题,我应该满足哪些依赖?

Edit 1:编辑 1:

I updated Pandas and this is the stacktrace我更新了 Pandas,这是堆栈跟踪

Requirement already up-to-date: pandas in /home/fatima/miniconda2/lib/python2.7/site-packages (0.24.2)
Requirement already satisfied, skipping upgrade: pytz>=2011k in /home/fatima/miniconda2/lib/python2.7/site-packages (from pandas) (2018.9)
Requirement already satisfied, skipping upgrade: numpy>=1.12.0 in /home/fatima/miniconda2/lib/python2.7/site-packages (from pandas) (1.16.2)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.5.0 in /home/fatima/miniconda2/lib/python2.7/site-packages (from pandas) (2.8.0)
Requirement already satisfied, skipping upgrade: six>=1.5 in /home/fatima/miniconda2/lib/python2.7/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)

Edit 2: this is what conda list gives me编辑 2:这就是 conda list 给我的

pandas                    0.24.2                   pypi_0    pypi

You will need to install the required packages:您将需要安装所需的软件包:

pip install pandas pyarrow s3fs fastparquet

If you are trying to read Parquet files in Pandas, it may be that you don't have one of the engines installed for reading Parquet files, such as pyarrow or fastparquet .如果您尝试在 Pandas 中读取 Parquet 文件,可能是因为您没有安装用于读取 Parquet 文件的引擎之一,例如pyarrowfastparquet You would need to install those dependencies as Pandas read_parquet requires either of these engines in order to read Parquet files.您需要安装这些依赖项,因为 Pandas read_parquet需要这些引擎中的任何一个才能读取 Parquet 文件。 For each of those dependencies, you would also need to figure out which dependencies are required for installing each of those libraries.对于每个依赖项,您还需要确定安装每个库所需的依赖项。

If this isn't the issue, can you please comment on what the error you are encountering may be?如果这不是问题,您能否评论一下您遇到的错误可能是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM