To read a .parquet
file with Python, the pandas library is your friend. In fact, pandas provides a convenient way to read and write data in a variety of formats (you might be familiar with CSV or XLS[X] files), including Parquet.
I create a small example to show you:
import pandas as pd
## read the Parquet file into a DataFrame
df = pd.read_parquet('example.parquet')
## display the DataFrame
print(df)
Note: The file is assumed to be in the current working directory with the name example.parquet
.
- you can change the name of the file from
example
todf
ordata_source
- you can change the directory to save this file by adding
folder/subfolder/example.parquet
- you can also change the directory using
os
You might be interested by learning how to write/create .parquet
file in Python