简体   繁体   English

如何使用python 2.7或更低版​​本读取和写入镶木地板文件

[英]How to read and write parquet files using python version 2.7 or less

I wanted to read -> update -> write parquet files using python 2.7 or less version. 我想阅读->更新->使用python 2.7或更低版​​本编写镶木地板文件。 facing issue related to packages. 面临与包装有关的问题。 please let me know the correct way to do the same. 请让我知道正确的方法。

You can use pyarrow to read Parquet files with Python 2.7, see https://arrow.apache.org/docs/python/parquet.html Note that there are no Python 2.7 wheels available for Windows. 您可以使用pyarrow来通过Python 2.7读取Parquet文件,请参见https://arrow.apache.org/docs/python/parquet.html。请注意,Windows没有可用的Python 2.7轮子。 You either need to use conda there or switch to Linux / OSX. 您要么在那里使用conda要么切换到Linux / OSX。

Read Parquet files: 读取Parquet文件:

import pyarrow.parquet as pq
table = pq.read_table("file.parquet")
# Optionally convert to Pandas DataFrame
df = table.to_pandas()

Write Parquet files: 编写Parquet文件:

import pyarrow as pa
import pyarrow.parquet as pq

# If your input data is a Pandas DataFrame, we need to convert it to an Arrow table first.
table = pa.Table.from_pandas(df)
pq.write_table(table, "filename.parquet")

暂无
暂无

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

相关问题 如何在 Python 中读取嵌套的 struct Parquet 文件? - How to read nested struct Parquet files in Python? 如何在Python 2.7中打开,读取和写入文件 - 将代码从fortran 90转换为Python - How to Open, Read, and Write files in Python 2.7 — Converting code from fortran 90 to Python 使用 Python 2.7 读写 CSV 文件,包括 unicode - Read and Write CSV files including unicode with Python 2.7 如何在Python v2.7中批量读取然后将Weblink .JSON文件列表写入C驱动器上的指定位置 - How to batch read and then write a list of weblink .JSON files to specified locations on C drive in Python v2.7 如何在 python 中使用 pyarrow 从 S3 读取分区的镶木地板文件 - How to read partitioned parquet files from S3 using pyarrow in python 如何使用 python 中的 spark dataframe 从 AWS S3 读取镶木地板文件(pyspark) - How to read parquet files from AWS S3 using spark dataframe in python (pyspark) 如何使用 Dask/pyarrow 从 python 中的远程 HDFS 读取镶木地板文件 - How to read parquet files from remote HDFS in python using Dask/ pyarrow 如何在 python 中使用 awswrangler 从 S3 读取所有镶木地板文件 - How to read all parquet files from S3 using awswrangler in python 使用python将parquet文件分成3个parquet文件 - divide a parquet file into 3 parquet files using python 如何使用 pyspark 在 Hadoop 中读取 parquet 文件、更改数据类型并写入另一个 Parquet 文件 - How to Read a parquet file , change datatype and write to another Parquet file in Hadoop using pyspark
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM