Arthur Camberlein >> SEO & Data articles >> How to read a `.parquet` file in Python?

How to read a `.parquet` file in Python?

How to read a `.parquet` file in Python?

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.
  1. you can change the name of the file from example to df or data_source
  2. you can change the directory to save this file by adding folder/subfolder/example.parquet
  3. you can also change the directory using os

You might be interested by learning how to write/create .parquet file in Python

Back to blog

Blog post taggued in:Data, Python, Python SEO

Related blog posts: