[英]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.